Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 512 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 512 Bytes

Cyclic

Provide cyclic behaviour to your Sum ADTs

Consider the following datatype

data Days
  = Mon
  | Tue
  | Wed
  | Thu
  | Fri
  | Sat
  | Sun
  deriving (Eq, Show, Data, Cyclic)

Cyclic provides ffw and rev functions that can be used to cycle trough the data constructors.

User needs to specify the number to use to calculate the resulting constructor and the starting constructor.

ghci > rev 2 Mon
Sun
ghci > ffw 33 Tue
Sun