{-# OPTIONS_GHC -fglasgow-exts -fth -ddump-splices #-} module Test where import FunctorN import UnivAlg data N = Z | S N data BTree = Bud | Branch BTree BTree data Eq a => Test a = No | Yes a (Test a) | Test a :?: Test a deriving Show data Flippy a b = Stop a | Flippy b (Flippy b a) deriving Show data PosFun a b = Val b | Fun (a -> PosFun a b) data GenFun a = Val1 a | Fun1 (GenFun a -> GenFun a) -- this one needs an instance of Functor2 (->) ! data Rose a = Rose a [Rose a] deriving Show data Climber a = Climber a [[Climber a]] deriving Show data Thorn a = Leaf | Thorn a (Thorn [a]) deriving Show data Thicket a = Tip | Thicket a (Thicket (Thicket a)) deriving Show instance Functor Thicket where fmap f Tip = Tip fmap f (Thicket x t) = Thicket (f x) (fmap (fmap f) t) data Tangle a = Tangle a ([Tangle a], Tangle [a]) deriving Show $(declareClass ''Tangle)