Copyright | (c) 2018 Jiasen Wu |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Jiasen Wu <jiasenwu@hotmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
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"))
Documentation
uncons :: (Generic a, Rep a ~ D1 ma ra, Uncons a ~ (b, c), Generic b, Rep b ~ D1 mb rb, Generic c, Rep c ~ D1 mc rc, UnconsR ra, HeadR ra ~ rb, TailR ra ~ rc) => a -> Uncons a 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, ()) |