Ticket #5448: ghcloop.hs
| File ghcloop.hs, 480 bytes (added by ronwalf, 21 months ago) |
|---|
| Line | |
|---|---|
| 1 | {-# LANGUAGE |
| 2 | DeriveDataTypeable, |
| 3 | TypeOperators |
| 4 | #-} |
| 5 | module GHCLoop where |
| 6 | |
| 7 | newtype Expr f = In (f (Expr f)) |
| 8 | |
| 9 | class Functor f => FuncEq f where |
| 10 | funcEq :: FuncEq g => f (Expr g) -> f (Expr g) -> Bool |
| 11 | |
| 12 | instance (FuncEq f) => Eq (Expr f) where |
| 13 | (In x) == (In y) = funcEq x y |
| 14 | |
| 15 | data Not e = Not e |
| 16 | instance Functor Not where |
| 17 | fmap f (Not e) = Not $ f e |
| 18 | instance FuncEq Not where |
| 19 | funcEq (Not x) (Not y) = x == y |
| 20 | |
| 21 | data GoalLit e = GoalLit (Expr Not) deriving (Eq) |
