first-class-patterns-0.3.2.4: First class patterns and pattern matching, using type families

LicenseBSD3
MaintainerBrent Yorgey <byorgey@cis.upenn.edu>
Stabilityexperimental
Portabilitynon-portable (see .cabal)
Safe HaskellNone
LanguageHaskell2010

Data.Pattern.Base.Tuple

Contents

Description

Various types defined inductively as type families or data families on type-lists.

Synopsis

Functions

type family Fun (xs :: [*]) r #

Curried functions. We have

Fun '[x1, ..., xn] r   =   x1 -> ... -> xn -> r
Instances
type Fun ([] :: [*]) r # 
Instance details

Defined in Data.Pattern.Base.Tuple

type Fun ([] :: [*]) r = r
type Fun (h ': t) r # 
Instance details

Defined in Data.Pattern.Base.Tuple

type Fun (h ': t) r = h -> Fun t r

Tuples

data Tuple xs #

Tuples with types given by xs.

zeroT :: Tuple '[] #

The empty tuple

oneT :: a -> Tuple '[a] #

The singleton tuple

(<+>) :: Tuple xs -> Tuple ys -> Tuple (xs :++: ys) #

Concatenation of tuples.

runTuple :: Tuple xs -> Fun xs r -> r #

Runs a tuple by applying it to a curried function.

Mapping and distributing over tuples

type family Map (f :: * -> *) (xs :: [*]) :: [*] #

Instances
type Map f ([] :: [*]) # 
Instance details

Defined in Data.Pattern.Base.Tuple

type Map f ([] :: [*]) = ([] :: [*])
type Map f (h ': t) # 
Instance details

Defined in Data.Pattern.Base.Tuple

type Map f (h ': t) = f h ': Map f t

class Distribute xs where #

Minimal complete definition

distribute

Methods

distribute :: Functor f => f (Tuple xs) -> Tuple (Map f xs) #

Instances
Distribute ([] :: [*]) # 
Instance details

Defined in Data.Pattern.Base.Tuple

Methods

distribute :: Functor f => f (Tuple []) -> Tuple (Map f []) #

(Uncurriable t, Tupable t, Distribute t) => Distribute (h ': t) # 
Instance details

Defined in Data.Pattern.Base.Tuple

Methods

distribute :: Functor f => f (Tuple (h ': t)) -> Tuple (Map f (h ': t)) #