RepLib-0.5.4: Generic programming library with representation types

Copyright(c) The University of Pennsylvania, 2006
LicenseBSD
Maintainersweirich@cis.upenn.edu
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Generics.RepLib.SYB.Aliases

Contents

Description

 

Synopsis

Combinators to "make" generic functions via cast

mkT :: (Rep a, Rep b) => (b -> b) -> a -> a Source #

Make a generic transformation; start from a type-specific case; preserve the term otherwise

mkQ :: (Rep a, Rep b) => r -> (b -> r) -> a -> r Source #

Make a generic query; start from a type-specific case; return a constant otherwise

mkM :: (Monad m, Rep a, Rep b) => (b -> m b) -> a -> m a Source #

Make a generic monadic transformation; start from a type-specific case; resort to return otherwise

mkMp :: (MonadPlus m, Rep a, Rep b) => (b -> m b) -> a -> m a Source #

Make a generic monadic transformation for MonadPlus; use "const mzero" (i.e., failure) instead of return as default.

mkR :: (MonadPlus m, Rep a, Rep b) => m b -> m a Source #

Make a generic builder; start from a type-specific ase; resort to no build (i.e., mzero) otherwise

ext0 :: (Rep a, Rep b) => c a -> c b -> c a Source #

Flexible type extension

extT :: (Rep a, Rep b) => (a -> a) -> (b -> b) -> a -> a Source #

Extend a generic transformation by a type-specific case

extQ :: (Rep a, Rep b) => (a -> q) -> (b -> q) -> a -> q Source #

Extend a generic query by a type-specific case

extM :: (Monad m, Rep a, Rep b) => (a -> m a) -> (b -> m b) -> a -> m a Source #

Extend a generic monadic transformation by a type-specific case

extMp :: (MonadPlus m, Rep a, Rep b) => (a -> m a) -> (b -> m b) -> a -> m a Source #

Extend a generic MonadPlus transformation by a type-specific case

extB :: (Rep a, Rep b) => a -> b -> a Source #

Extend a generic builder

extR :: (Monad m, Rep a, Rep b) => m a -> m b -> m a Source #

Extend a generic reader

Type synonyms for generic function types

type GenericT = forall a. Rep a => a -> a Source #

Generic transformations, i.e., take an "a" and return an "a"

type GenericQ r = forall a. Rep a => a -> r Source #

Generic queries of type "r", i.e., take any "a" and return an "r"

type GenericM m = forall a. Rep a => a -> m a Source #

Generic monadic transformations, i.e., take an "a" and compute an "a"

type GenericB = forall a. Rep a => a Source #

Generic builders i.e., produce an "a".

type GenericR m = forall a. Rep a => m a Source #

Generic readers, say monadic builders, i.e., produce an "a" with the help of a monad "m".

type Generic c = forall a. Rep a => a -> c a Source #

The general scheme underlying generic functions assumed by gfoldl; there are isomorphisms such as GenericT = Generic T.

data Generic' c Source #

Wrapped generic functions; recall: [Generic c] would be legal but [Generic' c] not.

Constructors

Generic' 

Fields

newtype GenericT' Source #

Other first-class polymorphic wrappers

Constructors

GT 

Fields

  • unGT :: forall a. Rep a => a -> a
     

newtype GenericQ' r Source #

Constructors

GQ 

Fields

newtype GenericM' m Source #

Constructors

GM 

Fields

  • unGM :: forall a. Rep a => a -> m a
     

Inredients of generic functions

orElse :: Maybe a -> Maybe a -> Maybe a Source #

Left-biased choice on maybies

Function combinators on generic functions

recoverMp :: MonadPlus m => GenericM m -> GenericM m Source #

Recover from the failure of monadic transformation by identity

recoverQ :: MonadPlus m => r -> GenericQ (m r) -> GenericQ (m r) Source #

Recover from the failure of monadic query by a constant

choiceMp :: MonadPlus m => GenericM m -> GenericM m -> GenericM m Source #

Choice for monadic transformations

choiceQ :: MonadPlus m => GenericQ (m r) -> GenericQ (m r) -> GenericQ (m r) Source #

Choice for monadic queries

Type extension for unary type constructors