enumerate: enumerate all the values in a finite type (automatically)

[ data, library, mit, program ] [ Propose Tags ]

provides (1) a typeclass for enumerating all values in a finite type, (2) a generic instance for automatic deriving, and (3) helpers that reify functions (partial or total, monadic or pure) into a Map.


[Skip to Readme]
Versions [faq] 0.0.0, 0.1.0, 0.1.1, 0.2.1, 0.2.2
Dependencies array (==0.5.*), base (==4.8.*), containers (==0.5.*), deepseq (==1.4.*), enumerate, exceptions (==0.8.*), ghc-prim (==0.4.*), MemoTrie (==0.6.*), semigroups (==0.18.*), template-haskell (==2.10.*), vinyl (==0.5.*) [details]
License MIT
Author Sam Boosalis
Maintainer samboosalis@gmail.com
Category Data
Home page https://github.com/sboosali/enumerate
Uploaded by sboo at Fri May 6 16:06:09 UTC 2016
Distributions NixOS:0.2.2
Executables enumerate-example
Downloads 2682 total (172 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2016-05-06 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for enumerate-0.1.1

[back to package description]

enumerate

enumerate all the values in a finite type (automatically) provides (1) a typeclass for enumerating all values in a finite type, (2) a generic instance for automatic deriving, and (3) helpers that reify functions (partial or total, monadic or pure) into a Map.

example

    {-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}
    import Data.Enumerate (Enumerable(..))
    import Data.Generics (Generics)

    data CrudOp = Add | Edit | Delete | View
     deriving (Eq,Ord,Enum,Bounded,Generic,Enumerable)
    data Route = Home | Person CrudOp | House CrudOp
     deriving (Eq,Ord,Generic,Enumerable)

    >>> enumerated :: [Route]
    [Home, Person Add, Person Edit, Person Delete, Person View, House Add, House Edit, House Delete, House View]

(extensive) documentation:

https://hackage.haskell.org/package/enumerate