Warning: Describes version 0.2, which is not yet released. I'm trying to get a working haddock 2.0 running (on my windows machine).
TypeCompose provides some classes & instances for forms of type composition, as well as some modules that haven't found another home.
- Read the Haddock docs (with source code, additional examples, and Comment/Talk links).
- Get the code repository: darcs get http://darcs.haskell.org/packages/TypeCompose, or
- Grab a distribution tarball.
- See the version history.
2 Type compositionThe
- Various type compositions (unary/unary, binary/unary, etc). Most are from Applicative Programming with Effects. In particular, composes functors in to functors and applicative functors (AFs) into AFs. (In contrast, monads do not in general compose.) Composition makes AF-based programming simple and elegant, partly because we don't need an AF counterpart to monad transformers.g `O` f
- Cofunctors (contravariant functors). Great for "consumer" types, just as functors suit "producer" (container) types. There are several composition options.
- Type argument flip. Handy for cofunctors: use , forFlip (->) o.(-> o)
- Constructor in pairs: .(f a, g a)
- Constructor in arrows/functions: .f a ~> g a
3 Other features
3.1 Composable bijections
Given all the type constructors and compositions of them, I found myself writing some pretty awkward code to wrap & unwrap through multiple layers. Composable bijections help a lot.The
3.2 Pair- & function-like typesThe
Monads with references. Direct rip-off from Global Variables in Haskell.