Copyright | (c) 2018 Jiasen Wu |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Jiasen Wu <jiasenwu@hotmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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"))
- uncons :: Unconsable a b c => a -> (b, c)
- type family Uncons a where ...
- 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)), UnconsR (UnD1 (Rep a)), HeadR (UnD1 (Rep a)) ~ UnD1 (Rep b), TailR (UnD1 (Rep a)) ~ UnD1 (Rep c))
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
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)), UnconsR (UnD1 (Rep a)), HeadR (UnD1 (Rep a)) ~ UnD1 (Rep b), TailR (UnD1 (Rep a)) ~ UnD1 (Rep c)) Source #
A constraint on any uncons
able data type, where
a
is the input type, and (b,c)
is the output type