Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implementations of the lazy data-structures.
Synopsis
- data Sum2 _1 _2
- data Sum3 _1 _2 _3
- data Sum4 _1 _2 _3 _4
- data Sum5 _1 _2 _3 _4 _5
- data Sum6 _1 _2 _3 _4 _5 _6
- data Sum7 _1 _2 _3 _4 _5 _6 _7
- type family a + b where ...
- type family a - b where ...
- data Unsubtracted minuend subtrahend
- data Product2 _1 _2 = Product2 _1 _2
- data Product3 _1 _2 _3 = Product3 _1 _2 _3
- data Product4 _1 _2 _3 _4 = Product4 _1 _2 _3 _4
- data Product5 _1 _2 _3 _4 _5 = Product5 _1 _2 _3 _4 _5
- data Product6 _1 _2 _3 _4 _5 _6 = Product6 _1 _2 _3 _4 _5 _6
- data Product7 _1 _2 _3 _4 _5 _6 _7 = Product7 _1 _2 _3 _4 _5 _6 _7
- type family a * b where ...
- type family a / b where ...
- data Undivided dividend divisor
Sum-types
type family a + b where ... infixl 0 Source #
Automatically derives the sum-type of the according arity from expressions such as:
Int + Char + Bool
In that case it will resolve to:
Sum3 Int Char Bool
(Sum6 _1 _2 _3 _4 _5 _6) + _7 = Sum7 _1 _2 _3 _4 _5 _6 _7 | |
(Sum5 _1 _2 _3 _4 _5) + (Sum2 _6 _7) = Sum7 _1 _2 _3 _4 _5 _6 _7 | |
(Sum5 _1 _2 _3 _4 _5) + _6 = Sum6 _1 _2 _3 _4 _5 _6 | |
(Sum4 _1 _2 _3 _4) + (Sum3 _5 _6 _7) = Sum7 _1 _2 _3 _4 _5 _6 _7 | |
(Sum4 _1 _2 _3 _4) + (Sum2 _5 _6) = Sum6 _1 _2 _3 _4 _5 _6 | |
(Sum4 _1 _2 _3 _4) + _5 = Sum5 _1 _2 _3 _4 _5 | |
(Sum3 _1 _2 _3) + (Sum4 _4 _5 _6 _7) = Sum7 _1 _2 _3 _4 _5 _6 _7 | |
(Sum3 _1 _2 _3) + (Sum3 _4 _5 _6) = Sum6 _1 _2 _3 _4 _5 _6 | |
(Sum3 _1 _2 _3) + (Sum2 _4 _5) = Sum5 _1 _2 _3 _4 _5 | |
(Sum3 _1 _2 _3) + _4 = Sum4 _1 _2 _3 _4 | |
(Sum2 _1 _2) + (Sum5 _3 _4 _5 _6 _7) = Sum7 _1 _2 _3 _4 _5 _6 _7 | |
(Sum2 _1 _2) + (Sum4 _3 _4 _5 _6) = Sum6 _1 _2 _3 _4 _5 _6 | |
(Sum2 _1 _2) + (Sum3 _3 _4 _5) = Sum5 _1 _2 _3 _4 _5 | |
(Sum2 _1 _2) + (Sum2 _3 _4) = Sum4 _1 _2 _3 _4 | |
(Sum2 _1 _2) + _3 = Sum3 _1 _2 _3 | |
(Unsubtracted _1 _2) + _2 = _1 | |
(Unsubtracted _1 _2) + _3 = Unsubtracted (_1 + _3) _2 | |
_1 + (Sum6 _2 _3 _4 _5 _6 _7) = Sum7 _1 _2 _3 _4 _5 _6 _7 | |
_1 + (Sum5 _2 _3 _4 _5 _6) = Sum6 _1 _2 _3 _4 _5 _6 | |
_1 + (Sum4 _2 _3 _4 _5) = Sum5 _1 _2 _3 _4 _5 | |
_1 + (Sum3 _2 _3 _4) = Sum4 _1 _2 _3 _4 | |
_1 + (Sum2 _2 _3) = Sum3 _1 _2 _3 | |
_1 + (Unsubtracted _2 _1) = _2 | |
_1 + (Unsubtracted _2 _3) = Unsubtracted (_1 + _2) _3 | |
_1 + _2 = Sum2 _1 _2 |
Subtraction
type family a - b where ... infixl 0 Source #
An operator for removing elements from the sum-types. E.g.,
Int + Char + Bool - Char
is the same type as
Int + Bool
(Sum7 _1 _2 _3 _4 _5 _6 _7) - _1 = Sum6 _2 _3 _4 _5 _6 _7 | |
(Sum7 _1 _2 _3 _4 _5 _6 _7) - _2 = Sum6 _1 _3 _4 _5 _6 _7 | |
(Sum7 _1 _2 _3 _4 _5 _6 _7) - _3 = Sum6 _1 _2 _4 _5 _6 _7 | |
(Sum7 _1 _2 _3 _4 _5 _6 _7) - _4 = Sum6 _1 _2 _3 _5 _6 _7 | |
(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Unsubtracted _1 _2) - _3 = Unsubtracted (_1 - _3) _2 | |
_1 - (Sum7 _2 _3 _4 _5 _6 _7 _8) = ((((((_1 - _2) - _3) - _4) - _5) - _6) - _7) - _8 | |
_1 - (Sum6 _2 _3 _4 _5 _6 _7) = (((((_1 - _2) - _3) - _4) - _5) - _6) - _7 | |
_1 - (Sum5 _2 _3 _4 _5 _6) = ((((_1 - _2) - _3) - _4) - _5) - _6 | |
_1 - (Sum4 _2 _3 _4 _5) = (((_1 - _2) - _3) - _4) - _5 | |
_1 - (Sum3 _2 _3 _4) = ((_1 - _2) - _3) - _4 | |
_1 - (Sum2 _2 _3) = (_1 - _2) - _3 | |
_1 - _2 = Unsubtracted _1 _2 |
data Unsubtracted minuend subtrahend Source #
What you get, when the subtraction cannot yet be performed.
Happens when the minuend doesn't contain the subtrahend. E.g.,
Char - Bool
produces
Unsubtracted Char Bool
However it's possible to get back to the normal type, when you perform the required addition afterwards. E.g.,
Char - Bool + Bool
produces
Char
This construct actually exists primarily for that purpose.
Product-types
type family a * b where ... infixl 1 Source #
Automatically derives the product-type of the according arity from expressions such as:
Int * Char * Bool
In that case it will resolve to:
Product3 Int Char Bool
(Product6 _1 _2 _3 _4 _5 _6) * _7 = Product7 _1 _2 _3 _4 _5 _6 _7 | |
(Product5 _1 _2 _3 _4 _5) * (Product2 _6 _7) = Product7 _1 _2 _3 _4 _5 _6 _7 | |
(Product5 _1 _2 _3 _4 _5) * _6 = Product6 _1 _2 _3 _4 _5 _6 | |
(Product4 _1 _2 _3 _4) * (Product3 _5 _6 _7) = Product7 _1 _2 _3 _4 _5 _6 _7 | |
(Product4 _1 _2 _3 _4) * (Product2 _5 _6) = Product6 _1 _2 _3 _4 _5 _6 | |
(Product4 _1 _2 _3 _4) * _5 = Product5 _1 _2 _3 _4 _5 | |
(Product3 _1 _2 _3) * (Product4 _4 _5 _6 _7) = Product7 _1 _2 _3 _4 _5 _6 _7 | |
(Product3 _1 _2 _3) * (Product3 _4 _5 _6) = Product6 _1 _2 _3 _4 _5 _6 | |
(Product3 _1 _2 _3) * (Product2 _4 _5) = Product5 _1 _2 _3 _4 _5 | |
(Product3 _1 _2 _3) * _4 = Product4 _1 _2 _3 _4 | |
(Product2 _1 _2) * (Product5 _3 _4 _5 _6 _7) = Product7 _1 _2 _3 _4 _5 _6 _7 | |
(Product2 _1 _2) * (Product4 _3 _4 _5 _6) = Product6 _1 _2 _3 _4 _5 _6 | |
(Product2 _1 _2) * (Product3 _3 _4 _5) = Product5 _1 _2 _3 _4 _5 | |
(Product2 _1 _2) * (Product2 _3 _4) = Product4 _1 _2 _3 _4 | |
(Product2 _1 _2) * _3 = Product3 _1 _2 _3 | |
(Undivided _1 _2) * _2 = _1 | |
(Undivided _1 _2) * _3 = Undivided (_1 * _3) _2 | |
_1 * (Product6 _2 _3 _4 _5 _6 _7) = Product7 _1 _2 _3 _4 _5 _6 _7 | |
_1 * (Product5 _2 _3 _4 _5 _6) = Product6 _1 _2 _3 _4 _5 _6 | |
_1 * (Product4 _2 _3 _4 _5) = Product5 _1 _2 _3 _4 _5 | |
_1 * (Product3 _2 _3 _4) = Product4 _1 _2 _3 _4 | |
_1 * (Product2 _2 _3) = Product3 _1 _2 _3 | |
_1 * (Undivided _2 _1) = _2 | |
_1 * (Undivided _2 _3) = Undivided (_1 * _2) _3 | |
_1 * _2 = Product2 _1 _2 |
Division
type family a / b where ... infixl 1 Source #
An operator for removing elements from the product-types. E.g.,
Int * Char * Bool / Char
is the same type as
Int * Bool
(Product7 _1 _2 _3 _4 _5 _6 _7) / _1 = Product6 _2 _3 _4 _5 _6 _7 | |
(Product7 _1 _2 _3 _4 _5 _6 _7) / _2 = Product6 _1 _3 _4 _5 _6 _7 | |
(Product7 _1 _2 _3 _4 _5 _6 _7) / _3 = Product6 _1 _2 _4 _5 _6 _7 | |
(Product7 _1 _2 _3 _4 _5 _6 _7) / _4 = Product6 _1 _2 _3 _5 _6 _7 | |
(Product7 _1 _2 _3 _4 _5 _6 _7) / _5 = Product6 _1 _2 _3 _4 _6 _7 | |
(Product7 _1 _2 _3 _4 _5 _6 _7) / _6 = Product6 _1 _2 _3 _4 _5 _7 | |
(Product7 _1 _2 _3 _4 _5 _6 _7) / _7 = Product6 _1 _2 _3 _4 _5 _6 | |
(Product6 _1 _2 _3 _4 _5 _6) / _1 = Product5 _2 _3 _4 _5 _6 | |
(Product6 _1 _2 _3 _4 _5 _6) / _2 = Product5 _1 _3 _4 _5 _6 | |
(Product6 _1 _2 _3 _4 _5 _6) / _3 = Product5 _1 _2 _4 _5 _6 | |
(Product6 _1 _2 _3 _4 _5 _6) / _4 = Product5 _1 _2 _3 _5 _6 | |
(Product6 _1 _2 _3 _4 _5 _6) / _5 = Product5 _1 _2 _3 _4 _6 | |
(Product6 _1 _2 _3 _4 _5 _6) / _6 = Product5 _1 _2 _3 _4 _5 | |
(Product5 _1 _2 _3 _4 _5) / _1 = Product4 _2 _3 _4 _5 | |
(Product5 _1 _2 _3 _4 _5) / _2 = Product4 _1 _3 _4 _5 | |
(Product5 _1 _2 _3 _4 _5) / _3 = Product4 _1 _2 _4 _5 | |
(Product5 _1 _2 _3 _4 _5) / _4 = Product4 _1 _2 _3 _5 | |
(Product5 _1 _2 _3 _4 _5) / _5 = Product4 _1 _2 _3 _4 | |
(Product4 _1 _2 _3 _4) / _1 = Product3 _2 _3 _4 | |
(Product4 _1 _2 _3 _4) / _2 = Product3 _1 _3 _4 | |
(Product4 _1 _2 _3 _4) / _3 = Product3 _1 _2 _4 | |
(Product4 _1 _2 _3 _4) / _4 = Product3 _1 _2 _3 | |
(Product3 _1 _2 _3) / _1 = Product2 _2 _3 | |
(Product3 _1 _2 _3) / _2 = Product2 _1 _3 | |
(Product3 _1 _2 _3) / _3 = Product2 _1 _2 | |
(Product2 _1 _2) / _1 = _2 | |
(Product2 _1 _2) / _2 = _1 | |
(Undivided _1 _2) / _3 = Undivided (_1 / _3) _2 | |
_1 / (Product7 _2 _3 _4 _5 _6 _7 _8) = ((((((_1 / _2) / _3) / _4) / _5) / _6) / _7) / _8 | |
_1 / (Product6 _2 _3 _4 _5 _6 _7) = (((((_1 / _2) / _3) / _4) / _5) / _6) / _7 | |
_1 / (Product5 _2 _3 _4 _5 _6) = ((((_1 / _2) / _3) / _4) / _5) / _6 | |
_1 / (Product4 _2 _3 _4 _5) = (((_1 / _2) / _3) / _4) / _5 | |
_1 / (Product3 _2 _3 _4) = ((_1 / _2) / _3) / _4 | |
_1 / (Product2 _2 _3) = (_1 / _2) / _3 | |
_1 / _2 = Undivided _1 _2 |
data Undivided dividend divisor Source #
What you get, when the division cannot yet be performed.
Happens when the dividend doesn't contain the divisor. E.g.,
Char / Bool
produces
Undivided Char Bool
However it's possible to get back to the normal type, when you perform the required multiplication afterwards. E.g.,
Char / Bool * Bool
produces
Char
This construct actually exists primarily for that purpose.