enumerate all the values in a finite type (automatically) https://github.com/sboosali/enumerate

Latest on Hackage:0.2.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

MIT licensed by Sam Boosalis
Maintained by samboosalis@gmail.com


Hackage Build Status

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 automatically deriving it, and


    {-# 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:


http://sboosali.github.io/documentation/enumerate/Enumerate.html (when hackage won't build the haddocks)


To reify functions, partial or total, into a Map, see enumerate-function.

comments powered byDisqus