on master help sign in
Merge pull request #2825 from Garciat/patch-1
2767cd4Edwin Brady
libs/prelude/Prelude.idr+6
@@ -207,6 +207,12 @@ instance Enum Int where
207 go [] = []
207 go [] = []
208 go (x :: xs) = n + (cast x * inc) :: go xs
208 go (x :: xs) = n + (cast x * inc) :: go xs
209
209
210+instance Enum Char where
211+ toNat c = toNat (ord c)
212+ fromNat n = chr (fromNat n)
213+
214+ pred c = fromNat (pred (toNat c))
215+
210syntax "[" [start] ".." [end] "]"
216syntax "[" [start] ".." [end] "]"
211 = enumFromTo start end
217 = enumFromTo start end
212syntax "[" [start] "," [next] ".." [end] "]"
218syntax "[" [start] "," [next] ".." [end] "]"