mono-traversable: Type classes for mapping, folding, and traversing monomorphic containers

[ data, library, mit ] [ Propose Tags ]

Monomorphic variants of the Functor, Foldable, and Traversable typeclasses. Contains even more experimental code for abstracting containers and sequences.

[Skip to Readme]
Versions [faq],,,,,, 0.3.1, 0.4.0,,,,, 0.5.0, 0.6.0,,,,, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.8.0,, 0.9.0,,, 0.9.1, 0.9.2,, 0.9.3, 0.10.0,, 0.10.1,, 0.10.2, 1.0.0,, 1.0.1,,,, 1.0.2,,,,,,,,,,,,,, (info)
Dependencies base (>=4.5 && <4.7), bytestring (>=0.9), comonad (>=3.0.3), containers (>=0.4), hashable, semigroupoids (>=3.0), semigroups (>=0.9), text (>=0.11), transformers (>=0.3), unordered-containers (>=0.2), vector (>=0.10), vector-instances [details]
License MIT
Author Michael Snoyman, John Wiegley, Greg Weber
Revised Revision 2 made by HerbertValerioRiedel at 2015-08-17T22:05:47Z
Category Data
Home page
Source repo head: git clone git://
Uploaded by MichaelSnoyman at 2014-02-16T16:27:54Z
Distributions Arch:, Debian:, Fedora:, FreeBSD:, LTSHaskell:, NixOS:, Stackage:, openSUSE:
Downloads 90403 total (892 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Successful builds reported [all 1 reports]




Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Readme for mono-traversable-

[back to package description]


Type classes for mapping, folding, and traversing monomorphic containers. Contains even more experimental code for abstracting containers and sequences.

Adding instances

If you have a data type which is a member of one of the relevant typeclasses (Functor, Foldable, Traversable), its quite easy to add an instance for MonoFunctor, MonoFoldable or MonoTraversable.

You just have to declare the proper type instance:

    {-# LANGUAGE TypeFamilies         #-}
    -- type instance Element T.Text = Char  -- already defined
    -- type instance Element [a] = a        -- here for example
    type instance Element (CustomType a) = a

And then, the needed instances:

    instance MonoFunctor (CustomType a)
    instance MonoFoldable (CustomType a)
    instance MonoTraversable (CustomType a)

in your code, and your ready to use CustomType a with the functions defined in this package.

Note: if your type is as monomorphic container without the proper typeclasses, then you will have to provide an implementation. However, this should be fairly simple, as it can be seen in the code

Build Status