Skip to content
/ cyclic Public

Add cyclic behaviour for any Sum type πŸŒ”

Notifications You must be signed in to change notification settings

v0d1ch/cyclic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 

Repository files navigation

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

About

Add cyclic behaviour for any Sum type πŸŒ”

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published