-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Compdata basics implemented on top of Fixplate -- -- This package implements the basic interface of Compdata using -- other packages which together provide similar functionality. -- -- Notably: -- -- @package compdata-fixplate @version 0.1 -- | A replacement for the basic machinery in Compdata. -- --

Differences and limitations

-- --

Deriving of type classes for base functors

-- -- Compdata's macros for deriving are replaced by similar macros from -- deriving-compat. See the documentation for defaultEqualF -- and similar functions in the same section. -- --

Co-products and injections

-- -- Compdata and Fixplate use different names for equivalent things. For -- this reason, we export type and pattern synonyms to make the interface -- as similar to Compdata's as possible. -- -- Unfortunately, :+: is defined as left-associative in Fixplate, -- which means that injections will look differently. For example, -- consider a compound base functor F :+: G :+: H. -- Elements from G are injected differently in the two -- libraries: -- --
--   Inr (Inl ...) -- Compdata
--   InL (InR ...) -- Fixplate
--   
-- -- (Note also the difference in capitalization.) -- --

Smart constructors

-- -- There are no TemplateHaskell macros for making smart constructors, but -- the operators from Data.Composition (re-exported by this -- module) take us a long way towards the same goal. Consider the -- following base functors: -- --
--   data Add a        = Add a a          deriving (Functor)
--   data IfThenElse a = IfThenElse a a a deriving (Functor)
--   
-- -- Smart versions of these constructors can now be defined as follows: -- --
--   (|+|) :: Add :<: f => Term f -> Term f -> Term f
--   (|+|) = inject .: Add
--   
--   ite :: IfThenElse :<: f => Term f -> Term f -> Term f -> Term f
--   ite = inject .:. IfThenElse
--   
module Data.Comp.Fixplate -- | Lifting of the Eq class to unary type constructors. class Eq1 (f :: * -> *) -- | "Functorised" versions of standard type classes. If you have your a -- structure functor, for example -- --
--   Expr e 
--     = Kst Int 
--     | Var String 
--     | Add e e 
--     deriving (Eq,Ord,Read,Show,Functor,Foldable,Traversable)
--   
-- -- you should make it an instance of these, so that the fixed-point type -- Mu Expr can be an instance of Eq, Ord and -- Show. Doing so is very easy: -- --
--   instance EqF   Expr where equalF     = (==)
--   instance OrdF  Expr where compareF   = compare
--   instance ShowF Expr where showsPrecF = showsPrec
--   
-- -- The Read instance depends on whether we are using GHC or not. -- The Haskell98 version is -- --
--   instance ReadF Expr where readsPrecF = readsPrec
--   
-- -- while the GHC version is -- --
--   instance ReadF Expr where readPrecF  = readPrec
--   
class EqF (f :: * -> *) equalF :: (EqF f, Eq a) => f a -> f a -> Bool -- | Lifting of the Show class to unary type constructors. class Show1 (f :: * -> *) class ShowF (f :: * -> *) showsPrecF :: (ShowF f, Show a) => Int -> f a -> ShowS -- | Generates an Eq1 instance declaration for the given data type -- or data family instance. deriveEq1 :: Name -> Q [Dec] -- | Generates a Show1 instance declaration for the given data type -- or data family instance. deriveShow1 :: Name -> Q [Dec] -- | Default implementation of equalF -- -- Use as follows: -- --
--   data F = ...
--   
--   deriveEq1 ''F -- Requires TemplateHaskell
--   instance EqF F where equalF = defaultEqualF
--   
defaultEqualF :: (Eq1 f, Eq a) => f a -> f a -> Bool -- | Default implementation of showsPrecF -- -- Use as follows: -- --
--   data F = ...
--   
--   deriveShow1 ''F -- Requires TemplateHaskell
--   instance ShowF F where showsPrecF = defaultShowsPrecF
--   
defaultShowsPrecF :: (Show1 f, Show a) => Int -> f a -> ShowS eqMod :: (EqF f, Functor f, Foldable f) => f a -> f b -> Maybe [(a, b)] type Term = Mu unTerm :: Term f -> f (Term f) type f :&: a = Ann f a -- | Sum of two functors data (:+:) (f :: * -> *) (g :: * -> *) a InL :: f a -> (:+:) a InR :: g a -> (:+:) a class f :<: g inj :: (:<:) f g => f a -> g a prj :: (:<:) f g => g a -> Maybe (f a) inject :: f :<: g => f (Term g) -> Term g project :: f :<: g => Term g -> Maybe (f (Term g)) data HideInj f a -- | Represent a Term as an ASCII drawing showTerm :: (Functor f, Foldable f, ShowF (HideInj f)) => Term f -> String -- | Represent a Term as a Unicode drawing showTermU :: (Functor f, Foldable f, ShowF (HideInj f)) => Term f -> String -- | Display a Term as an ASCII drawing drawTerm :: (Functor f, Foldable f, ShowF (HideInj f)) => Term f -> IO () -- | Display a Term as a Unicode drawing drawTermU :: (Functor f, Foldable f, ShowF (HideInj f)) => Term f -> IO () -- | Compose two functions. f .: g is similar to f . g -- except that g will be fed two arguments instead of one -- before handing its result to f. -- -- This function is defined as -- --
--   (f .: g) x y = f (g x y)
--   
-- -- Example usage: -- --
--   concatMap :: (a -> b) -> [a] -> [b]
--   concatMap = concat .: map
--   
-- -- Notice how two arguments (the function and the list) -- will be given to map before the result is passed to -- concat. This is equivalent to: -- --
--   concatMap f xs = concat (map f xs)
--   
(.:) :: () => c -> d -> a -> b -> c -> a -> b -> d infixr 8 .: -- | One compact pattern for composition operators is to "count the dots -- after the first one", which begins with the common .:, and -- proceeds by first appending another . and then replacing it -- with : (.:.) :: () => d -> e -> a -> b -> c -> d -> a -> b -> c -> e infixr 8 .:. (.::) :: () => d -> e -> a1 -> a2 -> b -> c -> d -> a1 -> a2 -> b -> c -> e infixr 8 .:: (.::.) :: () => d -> e -> a1 -> a2 -> a3 -> b -> c -> d -> a1 -> a2 -> a3 -> b -> c -> e infixr 8 .::. (.:::) :: () => d -> e -> a1 -> a2 -> a3 -> a4 -> b -> c -> d -> a1 -> a2 -> a3 -> a4 -> b -> c -> e infixr 8 .::: instance Data.Traversable.Traversable f => Data.Traversable.Traversable (Data.Comp.Fixplate.HideInj f) instance GHC.Base.Functor f => GHC.Base.Functor (Data.Comp.Fixplate.HideInj f) instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Data.Comp.Fixplate.HideInj f) instance GHC.Show.Show Data.Comp.Fixplate.Hole' instance Data.Generics.Fixplate.Base.ShowF f => Data.Generics.Fixplate.Base.ShowF (Data.Comp.Fixplate.HideInj f) instance (Data.Generics.Fixplate.Base.ShowF (Data.Comp.Fixplate.HideInj f), Data.Generics.Fixplate.Base.ShowF (Data.Comp.Fixplate.HideInj g)) => Data.Generics.Fixplate.Base.ShowF (Data.Comp.Fixplate.HideInj (f Data.Generics.Fixplate.Functor.:+: g)) instance f Data.Comp.Fixplate.:<: f instance (f Data.Comp.Fixplate.:<: f) => f Data.Comp.Fixplate.:<: (g Data.Generics.Fixplate.Functor.:+: f) instance (f Data.Comp.Fixplate.:<: h) => f Data.Comp.Fixplate.:<: (h Data.Generics.Fixplate.Functor.:+: g)