An open API service indexing awesome lists of open source software.

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)

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
False

Similarly, 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'