{-# OPTIONS_GHC -fglasgow-exts #-} -- Regular library with functional dependencies module Regular where data K a r = K { unK :: a } data I r = I { unI :: r } data U r = U data (f :+: g) r = L (f r) | R (g r) data (f :*: g) r = f r :*: g r data C c f r = C { unC :: f r } infixr 6 :+: infixr 7 :*: class Constructor c where conName :: t c (f :: * -> *) r -> String conFixity :: t c (f :: * -> *) r -> Fixity conFixity = const Prefix data Fixity = Prefix | Infix Associativity Int deriving (Eq, Show, Ord, Read) data Associativity = LeftAssociative | RightAssociative | NotAssociative deriving (Eq, Show, Ord, Read) class Regular a where type PF a :: * -> * from :: a -> PF a a to :: PF a a -> a