Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Iso alpha beta
- inverse :: Iso alpha beta -> Iso beta alpha
- apply :: Iso alpha beta -> alpha -> Maybe beta
- unapply :: Iso alpha beta -> beta -> Maybe alpha
- class IsoFunctor f where
- ignore :: alpha -> Iso alpha ()
- (***) :: Iso alpha beta -> Iso gamma delta -> Iso (alpha, gamma) (beta, delta)
- (|||) :: Iso alpha gamma -> Iso beta gamma -> Iso (Either alpha beta) gamma
- associate :: Iso (alpha, (beta, gamma)) ((alpha, beta), gamma)
- commute :: Iso (alpha, beta) (beta, alpha)
- unit :: Iso alpha (alpha, ())
- element :: Eq alpha => alpha -> Iso () alpha
- subset :: (alpha -> Bool) -> Iso alpha alpha
- iterate :: Iso alpha alpha -> Iso alpha alpha
- distribute :: Iso (alpha, Either beta gamma) (Either (alpha, beta) (alpha, gamma))
Documentation
element :: Eq alpha => alpha -> Iso () alpha Source #
`element x` is the partial isomorphism between ()
and the
singleton set which contains just x
.
subset :: (alpha -> Bool) -> Iso alpha alpha Source #
For a predicate p
, `subset p` is the identity isomorphism
restricted to elements matching the predicate.
distribute :: Iso (alpha, Either beta gamma) (Either (alpha, beta) (alpha, gamma)) Source #
Products distribute over sums.