Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- nullable1 :: forall xs. MatchI E xs => HList xs -> ()
- nullable2 :: forall xs. MatchI (S (V Bool)) xs => HList xs -> [Bool]
- nullable3 :: forall xs. MatchI (V Bool \/ E) xs => HList xs -> Maybe Bool
- nullable4 :: forall xs. MatchI (E \/ V Bool) xs => HList xs -> Maybe Bool
- nullable5 :: forall xs. MatchI (E <> E) xs => HList xs -> ()
- nullable6 :: forall xs. MatchI (E <> (E <> S (V Bool))) xs => HList xs -> ()
- unitEx :: forall xs a. MatchI (V a) xs => HList xs -> a
- unitEx' :: a -> REList (V a)
- pairEx :: forall xs a b. MatchI (V a <> V b) xs => HList xs -> (a, b)
- pairEx' :: (a, b) -> REList (V a <> V b)
- tripleEx :: forall xs a b c. MatchI (V a <> (V b <> V c)) xs => HList xs -> (a, b, c)
- tripleExB :: forall xs a b c. MatchI ((V a <> V b) <> V c) xs => HList xs -> (a, b, c)
- tripleExC :: forall xs b c. MatchI ((E <> V b) <> V c) xs => HList xs -> ((), b, c)
- untaggedSumEx :: forall xs a b. MatchI (V a \/ V b) xs => HList xs -> Either a b
- untaggedSumEx' :: Either a b -> REList (V a \/ V b)
- data InL = InL
- data InR = InR
- type Sum a b = (V InL <> V a) \/ (V InR <> V b)
- taggedSumEx :: forall xs a b. MatchI (Sum a b) xs => HList xs -> Either a b
- taggedSumEx' :: Either a b -> REList (Sum a b)
- listEx :: forall xs a. MatchI (S (V a)) xs => HList xs -> [a]
- listEx' :: [a] -> REList (S (V a))
Nullable
Nullable regular expression is regular expression which matches on empty list.
nullable2 :: forall xs. MatchI (S (V Bool)) xs => HList xs -> [Bool] Source #
for all RE
rr
is nullable
nullable3 :: forall xs. MatchI (V Bool \/ E) xs => HList xs -> Maybe Bool Source #
r
is nullable if either :\/
sr
or s
is nullable.
nullable4 :: forall xs. MatchI (E \/ V Bool) xs => HList xs -> Maybe Bool Source #
r
is nullable if either :\/
sr
or s
is nullable.
nullable5 :: forall xs. MatchI (E <> E) xs => HList xs -> () Source #
r
is nullable if both :<>
sr
or s
are nullable.
nullable6 :: forall xs. MatchI (E <> (E <> S (V Bool))) xs => HList xs -> () Source #
Complex example.
Isomorphism examples
HList
can be abused for many things:
Unit, tuples i.e. products
tripleEx :: forall xs a b c. MatchI (V a <> (V b <> V c)) xs => HList xs -> (a, b, c) Source #
Triple
tripleExB :: forall xs a b c. MatchI ((V a <> V b) <> V c) xs => HList xs -> (a, b, c) Source #
Triple, associated other way
Untagged sum
Tagged sum
type Sum a b = (V InL <> V a) \/ (V InR <> V b) Source #
Think: Either
, keywords make match less ambiguous.
taggedSumEx :: forall xs a b. MatchI (Sum a b) xs => HList xs -> Either a b Source #
Tagged union: "proper" Either
.