https://github.com/bapjiws/circular-haskell-enum
Haskell Enum that wraps around (i.e., does now stop as its maxBound and minBound)
https://github.com/bapjiws/circular-haskell-enum
Last synced: 3 months ago
JSON representation
Haskell Enum that wraps around (i.e., does now stop as its maxBound and minBound)
- Host: GitHub
- URL: https://github.com/bapjiws/circular-haskell-enum
- Owner: bapjiws
- Created: 2015-10-12T09:40:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-12T09:51:42.000Z (over 9 years ago)
- Last Synced: 2025-01-28T16:44:23.800Z (4 months ago)
- Language: Haskell
- Size: 281 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a realization of Haskell Enum that wraps around (i.e., does now stop as its maxBound and minBound).
For example, given that False is minBound for Bool and True is maxBound for Bool, here's what we can do:
GHCi> instance SafeEnum Bool
GHCi> spred False
True
GHCi> ssucc True
FalseSimilarly, given that '\NUL' is minBound for Char and '\1114111' is maxBound for Char, we can do the following:
GHCi> instance SafeEnum Char
GHCi> spred '\NUL'
'\1114111'
GHCi> ssucc '\1114111'
'\NUL'