Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.75 KB

README.md

File metadata and controls

44 lines (30 loc) · 1.75 KB

circular-enum

Circular successor & predecessor for bounded enum types

Build and test Publish API docs API docs
Hackage: circular-enum

import Data.Enum.Circular (csucc, cpred)

data Direction = N | E | S | W deriving (Show, Eq, Enum, Bounded)

show $ take 6 (iterate csucc N)
-- "[N,E,S,W,N,E]"

csucc and cpred are compatible with succ and pred, but they behave circular on the type boundaries. Requires Eq, Enum and Bounded instances.

Contributors

Contributor Covenant 2.0

Author and License

Copyright (c) 2023 Mirko Westermeier (@memowe)

Released under the MIT license. See LICENSE for details.