-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Partial isomorphisms. -- -- Partial isomorphisms as described in the paper: . Tillmann Rendel and -- Klaus Ostermann. Invertible Syntax Descriptions: Unifying Parsing and -- Pretty Printing. In Proc. of Haskell Symposium, 2010. . The -- paper also describes invertible syntax descriptions as a common -- interface for parsers and pretty printers. These are distributed -- separately in the invertible-syntax package. @package partial-isomorphisms @version 0.2.3.0 module Control.Isomorphism.Partial.Unsafe data Iso alpha beta Iso :: (alpha -> Maybe beta) -> (beta -> Maybe alpha) -> Iso alpha beta module Control.Isomorphism.Partial.TH -- | Construct a partial isomorphism expression for a constructor, given -- the constructor's name. constructorIso :: Name -> ExpQ defineIsomorphisms :: Name -> Q [Dec] module Control.Isomorphism.Partial.Prim 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 (<$>) :: IsoFunctor f => Iso alpha beta -> f alpha -> f beta infix 5 <$> ignore :: alpha -> Iso alpha () -- | the product type constructor (,) is a bifunctor from -- Iso $times$ Iso to Iso, so that we have the -- bifunctorial map *** which allows two separate isomorphisms to -- work on the two components of a tuple. (***) :: Iso alpha beta -> Iso gamma delta -> Iso (alpha, gamma) (beta, delta) -- | The mediating arrow for sums constructed with Either. This is -- not a proper partial isomorphism because of mplus. (|||) :: Iso alpha gamma -> Iso beta gamma -> Iso (Either alpha beta) gamma -- | Nested products associate. associate :: Iso (alpha, (beta, gamma)) ((alpha, beta), gamma) -- | Products commute. commute :: Iso (alpha, beta) (beta, alpha) -- | () is the unit element for products. unit :: Iso alpha (alpha, ()) -- | `element x` is the partial isomorphism between () and the -- singleton set which contains just x. element :: Eq alpha => alpha -> Iso () alpha -- | For a predicate p, `subset p` is the identity isomorphism -- restricted to elements matching the predicate. subset :: (alpha -> Bool) -> Iso alpha alpha iterate :: Iso alpha alpha -> Iso alpha alpha -- | Products distribute over sums. distribute :: Iso (alpha, Either beta gamma) (Either (alpha, beta) (alpha, gamma)) instance Control.Category.Category Control.Isomorphism.Partial.Unsafe.Iso module Control.Isomorphism.Partial.Constructors nil :: Iso () [alpha] cons :: Iso (alpha, [alpha]) [alpha] listCases :: Iso (Either () (alpha, [alpha])) [alpha] left :: forall (a_a4if :: Type) (b_a4ig :: Type). Iso a_a4if (Either (a_a4if :: Type) (b_a4ig :: Type)) right :: forall (a_a4if :: Type) (b_a4ig :: Type). Iso b_a4ig (Either (a_a4if :: Type) (b_a4ig :: Type)) nothing :: forall (a_11 :: Type). Iso () (Maybe (a_11 :: Type)) just :: forall (a_11 :: Type). Iso a_11 (Maybe (a_11 :: Type)) module Control.Isomorphism.Partial.Derived foldl :: Iso (alpha, beta) alpha -> Iso (alpha, [beta]) alpha module Control.Isomorphism.Partial