MHask-0.3.0.0: The category of monads

Safe HaskellSafe-Inferred

MHask.Arrow

Description

This module sets the stage for the rest of the package. It defines a type synonym ~> which cleans up the type signatures, and ~>~ which is used in the default implementation of bind. These represent the type of arrows and arrow composition in MHask, respectively.

By using ~>, type signatures for the MHask class operations can be easily compared to their Hask counterparts. However, as a reminder that you are dealing with Monads, where typically you would see a and b in the Hask counterpart, you will instead see m and n, and where you would typically see m or w, you will instead see t, as a mnemonic for Monad transformer.

For illustrative purposes, this module also provides <~ and ~<~, to clearly illustrate how duals are nothing more than just "flipping the arrows". You are encouraged to compare docs or even source files to see just how similar they are, all the way down to default implementations.

Synopsis

Documentation

type (~>) m n = forall x. m x -> n xSource

The ~> type represents arrows in the category of MHask.

type (<~) m n = n ~> mSource

It's just ~> flipped.

 type m <~ n = n ~> m

(~>~) :: (Monad a, Monad b, Monad c) => (a ~> b) -> (b ~> c) -> a ~> cSource

Left-to-right composition of arrows in MHask.

(~<~) :: (Monad a, Monad b, Monad c) => (c <~ b) -> (b <~ a) -> c <~ aSource

It's just ~>~ flipped.

 (~<~) = flip (~>~)