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

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

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 Source

Curried functions. We have

Fun '[x1, ..., xn] r   =   x1 -> ... -> xn -> r

Tuples

data Tuple xs Source

Tuples with types given by xs.

zeroT :: Tuple `[]`Source

The empty tuple

oneT :: a -> Tuple `[a]`Source

The singleton tuple

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

Concatenation of tuples.

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

Runs a tuple by applying it to a curried function.

Mapping and distributing over tuples

type family Map f xs :: [*]Source

class Distribute xs whereSource

Methods

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

Instances

Distribute ([] *) 
(Uncurriable t, Tupable t, Distribute t) => Distribute (: * h t)