We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
succ
pred
1 parent ab2c76b commit ebe0f8eCopy full SHA for ebe0f8e
src/Data/Enum.purs
@@ -5,3 +5,9 @@ import Data.Maybe
5
class Enum a where
6
toEnum :: Number -> Maybe a
7
fromEnum :: a -> Number
8
+
9
+succ :: forall a. (Enum a) => a -> Maybe a
10
+succ x = toEnum (fromEnum x + 1)
11
12
+pred :: forall a. (Enum a) => a -> Maybe a
13
+pred x = toEnum (fromEnum x - 1)
0 commit comments