RepLib-0.5.4.1: Generic programming library with representation types

LicenseBSD
Maintainersweirich@cis.upenn.edu
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Generics.RepLib.RepAux

Contents

Description

Auxiliary operations to aid in the definition of type-indexed functions

Synopsis

Casting operations

eqR :: R a -> R b -> Bool Source #

Determine if two reps are for the same type

cast :: forall a b. (Rep a, Rep b) => a -> Maybe b Source #

The type-safe cast operation, implicit arguments

castR :: R a -> R b -> a -> Maybe b Source #

The type-safe cast operation, explicit arguments

gcast :: forall a b c. (Rep a, Rep b) => c a -> Maybe (c b) Source #

Leibniz equality between types, implicit representations

gcastR :: forall a b c. R a -> R b -> c a -> Maybe (c b) Source #

Leibniz equality between types, explicit representations

Comparison

compareR :: R a -> R b -> Ordering Source #

Heterogeneous Ordering

Operations for heterogeneous lists

findCon :: [Con ctx a] -> a -> Val ctx a Source #

Given a list of constructor representations for a datatype, determine which constructor formed the datatype.

data Val ctx a where Source #

A datastructure to store the results of findCon

Constructors

Val :: Emb l a -> MTup ctx l -> l -> Val ctx a 

foldl_l :: (forall a. Rep a => ctx a -> b -> a -> b) -> b -> MTup ctx l -> l -> b Source #

A fold left for heterogeneous lists

foldr_l :: (forall a. Rep a => ctx a -> a -> b -> b) -> b -> MTup ctx l -> l -> b Source #

A fold right operation for heterogeneous lists, that folds a function expecting a type type representation across each element of the list.

map_l :: (forall a. Rep a => ctx a -> a -> a) -> MTup ctx l -> l -> l Source #

A map for heterogeneous lists

mapQ_l :: (forall a. Rep a => ctx a -> a -> r) -> MTup ctx l -> l -> [r] Source #

Transform a heterogeneous list in to a standard list

mapM_l :: Monad m => (forall a. Rep a => ctx a -> a -> m a) -> MTup ctx l -> l -> m l Source #

mapM for heterogeneous lists

fromTup :: (forall a. Rep a => ctx a -> a) -> MTup ctx l -> l Source #

Generate a heterogeneous list from metadata

fromTupM :: Monad m => (forall a. Rep a => ctx a -> m a) -> MTup ctx l -> m l Source #

Generate a heterogeneous list from metadata, in a monad

toList :: (forall a. Rep a => ctx a -> b) -> MTup ctx l -> [b] Source #

Generate a normal lists from metadata

SYB style operations (Rep)

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

A SYB style traversal

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

SYB style query type

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

SYB style monadic map type

gmapT :: forall a. Rep a => Traversal -> a -> a Source #

Map a traversal across the kids of a data structure

gmapQ :: forall a r. Rep a => Query r -> a -> [r] Source #

gmapM :: forall a m. (Rep a, Monad m) => MapM m -> a -> m a Source #

SYB style operations (Rep1)

type Traversal1 ctx = forall a. Rep a => ctx a -> a -> a Source #

type Query1 ctx r = forall a. Rep a => ctx a -> a -> r Source #

type MapM1 ctx m = forall a. Rep a => ctx a -> a -> m a Source #

gmapT1 :: forall a ctx. Rep1 ctx a => Traversal1 ctx -> a -> a Source #

gmapQ1 :: forall a ctx r. Rep1 ctx a => Query1 ctx r -> a -> [r] Source #

gmapM1 :: forall a ctx m. (Rep1 ctx a, Monad m) => MapM1 ctx m -> a -> m a Source #

SYB Reloaded

data Typed a Source #

Constructors

a ::: (R a) infixr 7 

data Spine a where Source #

Constructors

Constr :: a -> Spine a 
(:<>) :: Spine (a -> b) -> Typed a -> Spine b 

toSpine :: Rep a => a -> Spine a Source #

Orphan instances

Eq DT Source # 
Instance details

Methods

(==) :: DT -> DT -> Bool #

(/=) :: DT -> DT -> Bool #

Ord DT Source # 
Instance details

Methods

compare :: DT -> DT -> Ordering #

(<) :: DT -> DT -> Bool #

(<=) :: DT -> DT -> Bool #

(>) :: DT -> DT -> Bool #

(>=) :: DT -> DT -> Bool #

max :: DT -> DT -> DT #

min :: DT -> DT -> DT #

TestEquality R Source # 
Instance details

Methods

testEquality :: R a -> R b -> Maybe (a :~: b) #