tuple-ops-0.0.0.2: various operations on n-ary tuples via GHC.Generics

Copyright(c) 2018 Jiasen Wu
LicenseBSD-style (see the file LICENSE)
MaintainerJiasen Wu <jiasenwu@hotmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Tuple.Ops.Uncons

Description

This module define uncons. Examples are given below:

>>> uncons (1::Int)
(1,())
>>> uncons (1::Int,'a')
(1,'a')
>>> uncons (True,'a', "S")
(True,('a',"S"))

Synopsis

Documentation

uncons :: Unconsable a b c => a -> (b, c) Source #

uncons takes primitive, pair, tuple, and produces a pair of its first data and the rest elements.

type family Uncons a where ... Source #

calculate the result type of uncons

Equations

Uncons (a, b) = (a, b) 
Uncons (a, b, c) = (a, (b, c)) 
Uncons (a, b, c, d) = (a, (b, c, d)) 
Uncons (a, b, c, d, e) = (a, (b, c, d, e)) 
Uncons (a, b, c, d, e, f) = (a, (b, c, d, e, f)) 
Uncons (a, b, c, d, e, f, g) = (a, (b, c, d, e, f, g)) 
Uncons (a, b, c, d, e, f, g, h) = (a, (b, c, d, e, f, g, h)) 
Uncons (a, b, c, d, e, f, g, h, i) = (a, (b, c, d, e, f, g, h, i)) 
Uncons (a, b, c, d, e, f, g, h, i, j) = (a, (b, c, d, e, f, g, h, i, j)) 
Uncons (a, b, c, d, e, f, g, h, i, j, k) = (a, (b, c, d, e, f, g, h, i, j, k)) 
Uncons (a, b, c, d, e, f, g, h, i, j, k, l) = (a, (b, c, d, e, f, g, h, i, j, k, l)) 
Uncons (a, b, c, d, e, f, g, h, i, j, k, l, m) = (a, (b, c, d, e, f, g, h, i, j, k, l, m)) 
Uncons (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = (a, (b, c, d, e, f, g, h, i, j, k, l, m, n)) 
Uncons (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (a, (b, c, d, e, f, g, h, i, j, k, l, m, n, o)) 
Uncons (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) = (a, (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)) 
Uncons a = (a, ()) 

type Unconsable a b c = (Generic a, Generic b, Generic c, Uncons a ~ (b, c), Rep a ~ D1 (MetaOfD1 (Rep a)) (UnD1 (Rep a)), Rep b ~ D1 (MetaOfD1 (Rep b)) (UnD1 (Rep b)), Rep c ~ D1 (MetaOfD1 (Rep c)) (UnD1 (Rep c)), UnconsableR (UnD1 (Rep a)), HeadR (UnD1 (Rep a)) ~ UnD1 (Rep b), TailR (UnD1 (Rep a)) ~ UnD1 (Rep c)) Source #

A constraint on any unconsable data type, where a is the input type, and (b,c) is the output type