compdata-param-0.9.2: Parametric Compositional Data Types

Copyright(c) 2011 Patrick Bahr Tom Hvitved
LicenseBSD3
MaintainerTom Hvitved <hvitved@diku.dk>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellSafe
LanguageHaskell98

Data.Comp.Param.Ops

Description

This module provides operators on difunctors.

Synopsis
  • data (f :+: g) a b
  • caseD :: (f a b -> c) -> (g a b -> c) -> (f :+: g) a b -> c
  • class sub :<: sup where
    • data (f :*: g) a b = (f a b) :*: (g a b)
    • ffst :: (f :*: g) a b -> f a b
    • fsnd :: (f :*: g) a b -> g a b
    • data (f :&: p) a b = (f a b) :&: p
    • class DistAnn s p s' | s' -> s, s' -> p where
      • class RemA s s' | s -> s' where

        Documentation

        data (f :+: g) a b infixr 6 Source #

        Formal sum of signatures (difunctors).

        Constructors

        Inl (f a b) 
        Inr (g a b) 
        Instances
        f :<: g => f :<: (h :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        inj :: f a b -> (h :+: g) a b Source #

        proj :: (h :+: g) a b -> Maybe (f a b) Source #

        f :<: (f :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        inj :: f a b -> (f :+: g) a b Source #

        proj :: (f :+: g) a b -> Maybe (f a b) Source #

        (Difunctor f, Difunctor g) => Difunctor (f :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        dimap :: (a -> b) -> (c -> d) -> (f :+: g) b c -> (f :+: g) a d Source #

        (Ditraversable f, Ditraversable g) => Ditraversable (f :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        dimapM :: Monad m => (b -> m c) -> (f :+: g) a b -> m ((f :+: g) a c) Source #

        disequence :: Monad m => (f :+: g) a (m b) -> m ((f :+: g) a b) Source #

        (ShowD f, ShowD g) => ShowD (f :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Show

        Methods

        showD :: (f :+: g) Name (FreshM String) -> FreshM String Source #

        (EqD f, EqD g) => EqD (f :+: g) Source #

        EqD is propagated through sums.

        Instance details

        Defined in Data.Comp.Param.Equality

        Methods

        eqD :: PEq a => (f :+: g) Name a -> (f :+: g) Name a -> FreshM Bool Source #

        (OrdD f, OrdD g) => OrdD (f :+: g) Source #

        OrdD is propagated through sums.

        Instance details

        Defined in Data.Comp.Param.Ordering

        Methods

        compareD :: POrd a => (f :+: g) Name a -> (f :+: g) Name a -> FreshM Ordering Source #

        (Desugar f h, Desugar g h) => Desugar (f :+: g) h Source # 
        Instance details

        Defined in Data.Comp.Param.Desugar

        Methods

        desugHom :: Hom (f :+: g) h Source #

        desugHom' :: (f :+: g) a (Cxt h0 h a b) -> Cxt h0 h a b Source #

        DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        injectA :: p -> (f :+: s) a b -> ((f :&: p) :+: s') a b Source #

        projectA :: ((f :&: p) :+: s') a b -> ((f :+: s) a b, p) Source #

        RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        remA :: ((f :&: p) :+: s) a b -> (f :+: s') a b Source #

        (Eq (f a b), Eq (g a b)) => Eq ((f :+: g) a b) # 
        Instance details

        Defined in Data.Comp.Param.Sum

        Methods

        (==) :: (f :+: g) a b -> (f :+: g) a b -> Bool #

        (/=) :: (f :+: g) a b -> (f :+: g) a b -> Bool #

        (Ord (f a b), Ord (g a b)) => Ord ((f :+: g) a b) # 
        Instance details

        Defined in Data.Comp.Param.Sum

        Methods

        compare :: (f :+: g) a b -> (f :+: g) a b -> Ordering #

        (<) :: (f :+: g) a b -> (f :+: g) a b -> Bool #

        (<=) :: (f :+: g) a b -> (f :+: g) a b -> Bool #

        (>) :: (f :+: g) a b -> (f :+: g) a b -> Bool #

        (>=) :: (f :+: g) a b -> (f :+: g) a b -> Bool #

        max :: (f :+: g) a b -> (f :+: g) a b -> (f :+: g) a b #

        min :: (f :+: g) a b -> (f :+: g) a b -> (f :+: g) a b #

        (Show (f a b), Show (g a b)) => Show ((f :+: g) a b) # 
        Instance details

        Defined in Data.Comp.Param.Sum

        Methods

        showsPrec :: Int -> (f :+: g) a b -> ShowS #

        show :: (f :+: g) a b -> String #

        showList :: [(f :+: g) a b] -> ShowS #

        caseD :: (f a b -> c) -> (g a b -> c) -> (f :+: g) a b -> c Source #

        Utility function to case on a difunctor sum, without exposing the internal representation of sums.

        class sub :<: sup where Source #

        Signature containment relation for automatic injections. The left-hand must be an atomic signature, where as the right-hand side must have a list-like structure. Examples include f :<: f :+: g and g :<: f :+: (g :+: h), non-examples include f :+: g :<: f :+: (g :+: h) and f :<: (f :+: g) :+: h.

        Minimal complete definition

        inj, proj

        Methods

        inj :: sub a b -> sup a b Source #

        proj :: sup a b -> Maybe (sub a b) Source #

        Instances
        f :<: f Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        inj :: f a b -> f a b Source #

        proj :: f a b -> Maybe (f a b) Source #

        f :<: g => f :<: (h :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        inj :: f a b -> (h :+: g) a b Source #

        proj :: (h :+: g) a b -> Maybe (f a b) Source #

        f :<: (f :+: g) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        inj :: f a b -> (f :+: g) a b Source #

        proj :: (f :+: g) a b -> Maybe (f a b) Source #

        data (f :*: g) a b infixr 8 Source #

        Formal product of signatures (difunctors).

        Constructors

        (f a b) :*: (g a b) infixr 8 

        ffst :: (f :*: g) a b -> f a b Source #

        fsnd :: (f :*: g) a b -> g a b Source #

        data (f :&: p) a b infixr 7 Source #

        This data type adds a constant product to a signature.

        Constructors

        (f a b) :&: p infixr 7 
        Instances
        DistAnn f p (f :&: p) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        injectA :: p -> f a b -> (f :&: p) a b Source #

        projectA :: (f :&: p) a b -> (f a b, p) Source #

        Difunctor f => Difunctor (f :&: p) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        dimap :: (a -> b) -> (c -> d) -> (f :&: p) b c -> (f :&: p) a d Source #

        Ditraversable f => Ditraversable (f :&: p) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        dimapM :: Monad m => (b -> m c) -> (f :&: p) a b -> m ((f :&: p) a c) Source #

        disequence :: Monad m => (f :&: p) a (m b) -> m ((f :&: p) a b) Source #

        (ShowD f, Show p) => ShowD (f :&: p) Source # 
        Instance details

        Defined in Data.Comp.Param.Show

        Methods

        showD :: (f :&: p) Name (FreshM String) -> FreshM String Source #

        RemA (f :&: p) f Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        remA :: (f :&: p) a b -> f a b Source #

        DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        injectA :: p -> (f :+: s) a b -> ((f :&: p) :+: s') a b Source #

        projectA :: ((f :&: p) :+: s') a b -> ((f :+: s) a b, p) Source #

        RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        remA :: ((f :&: p) :+: s) a b -> (f :+: s') a b Source #

        class DistAnn s p s' | s' -> s, s' -> p where Source #

        This class defines how to distribute an annotation over a sum of signatures.

        Minimal complete definition

        injectA, projectA

        Methods

        injectA :: p -> s a b -> s' a b Source #

        Inject an annotation over a signature.

        projectA :: s' a b -> (s a b, p) Source #

        Project an annotation from a signature.

        Instances
        DistAnn f p (f :&: p) Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        injectA :: p -> f a b -> (f :&: p) a b Source #

        projectA :: (f :&: p) a b -> (f a b, p) Source #

        DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        injectA :: p -> (f :+: s) a b -> ((f :&: p) :+: s') a b Source #

        projectA :: ((f :&: p) :+: s') a b -> ((f :+: s) a b, p) Source #

        class RemA s s' | s -> s' where Source #

        Minimal complete definition

        remA

        Methods

        remA :: s a b -> s' a b Source #

        Remove annotations from a signature.

        Instances
        RemA (f :&: p) f Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        remA :: (f :&: p) a b -> f a b Source #

        RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # 
        Instance details

        Defined in Data.Comp.Param.Ops

        Methods

        remA :: ((f :&: p) :+: s) a b -> (f :+: s') a b Source #