Skip to content

Instantly share code, notes, and snippets.

@ovechkin-dm
Created March 19, 2018 13:20
Show Gist options
  • Save ovechkin-dm/0ec023d9f111d27a538a135643129d21 to your computer and use it in GitHub Desktop.
Save ovechkin-dm/0ec023d9f111d27a538a135643129d21 to your computer and use it in GitHub Desktop.
module Stepik () where
class (Enum a, Bounded a, Eq a) => SafeEnum a where
ssucc :: a -> a
ssucc x | x == maxBound = minBound
| otherwise = succ x
spred :: a -> a
spred x | x == minBound = maxBound
| otherwise = pred x
instance SafeEnum Bool
--instance SafeEnum a HOW??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment