module Data.Comp.Show
( ShowF(..)
) where
import Data.Comp.Algebra
import Data.Comp.Annotation
import Data.Comp.Derive (liftSum)
import Data.Comp.Derive.Show
import Data.Comp.Derive.Utils (derive)
import Data.Comp.Term
instance (Functor f, ShowF f) => ShowF (Cxt h f) where
showF (Hole s) = s
showF (Term t) = showF $ fmap showF t
instance (Functor f, ShowF f, Show a) => Show (Cxt h f a) where
show = free showF show
instance (ShowF f, Show p) => ShowF (f :&: p) where
showF (v :&: p) = showF v ++ " :&: " ++ show p
$(derive [liftSum] [''ShowF])
$(derive [makeShowF] [''Maybe, ''[], ''(,)])
instance (ShowConstr f, Show p) => ShowConstr (f :&: p) where
showConstr (v :&: p) = showConstr v ++ " :&: " ++ show p
$(derive [liftSum] [''ShowConstr])