Safe Haskell | Safe-Inferred |
---|
- data Iso a b = Iso (a -> Maybe b) (b -> Maybe a)
- convert :: Iso a b -> a -> Maybe b
- inverse :: Iso a b -> Iso b a
- many :: Iso a a -> Iso a a
- data h :- t = h :- t
- stack :: Iso a b -> Iso (a :- t) (b :- t)
- unstack :: Iso (a :- ()) (b :- ()) -> Iso a b
- swap :: Iso (a :- (b :- t)) (b :- (a :- t))
- duck :: Iso t1 t2 -> Iso (h :- t1) (h :- t2)
- lit :: Eq a => a -> Iso t (a :- t)
- inverseLit :: Eq a => a -> Iso (a :- t) t
- matchWithDefault :: (a -> Bool) -> a -> Iso t (a :- t)
- ignoreWithDefault :: a -> Iso t (a :- t)
Partial isomorphisms
Bidirectional partial isomorphism.
Stack-based isomorphisms
Heterogenous stack with a head and a tail.
h :- t |
matchWithDefault :: (a -> Bool) -> a -> Iso t (a :- t)Source
When converting from left to right, push the default value on top of the stack. When converting from right to left, pop the value, make sure it matches the predicate and then discard it.
ignoreWithDefault :: a -> Iso t (a :- t)Source
When converting from left to right, push the default value on top of the stack. When converting from right to left, pop the value and discard it.