on master help sign in
Change Show instance for Nat to show integers
d858016Edwin Brady
lib/Prelude.idr+3−4
@@ -24,10 +24,6 @@ import Prelude.Chars
24class Show a where
24class Show a where
25 show : a -> String
25 show : a -> String
26
26
27−instance Show Nat where
28− show O = "O"
29− show (S k) = "s" ++ show k
30−
31instance Show Int where
27instance Show Int where
32 show = prim__toStrInt
28 show = prim__toStrInt
33
29
@@ -43,6 +39,9 @@ instance Show Char where
43instance Show String where
39instance Show String where
44 show = id
40 show = id
45
41
42+instance Show Nat where
43+ show n = show (the Integer (cast n))
44+
46instance Show Bool where
45instance Show Bool where
47 show True = "True"
46 show True = "True"
48 show False = "False"
47 show False = "False"
test/reg004/expected+2−2
@@ -1,2 +1,2 @@
1−O
1+0
2−sO
2+1
test/reg017/expected+1−1
@@ -1 +1 @@
1−ssssO
1+4
test/test005/expected+1−1
@@ -1,5 +1,5 @@
18
18
2−sO
2+1
3(abc, 123)
3(abc, 123)
4(abc, 123)
4(abc, 123)
5([1, 2], [3, 4, 5])
5([1, 2], [3, 4, 5])
test/test007/expected+1−1
@@ -1,4 +1,4 @@
1Just 8
1Just 8
2−Just sssssssssO
2+Just 9
3Just 42
3Just 42
4Nothing
4Nothing
test/test019/expected+1−1
@@ -1 +1 @@
1−sO
1+1