File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ toNameImport x (Just mod) =
6565defaultSpecialRules :: SpecialRules
6666defaultSpecialRules = Map. fromList
6767 [ " Agda.Builtin.Nat.Nat" `to` " Natural" `importing` Just " Numeric.Natural"
68+ , " Agda.Builtin.Nat.Nat.zero" `to` " 0" `importing` Nothing
69+ , " Agda.Builtin.Nat.Nat.suc" `to` " succ" `importing` Nothing
6870 , " Haskell.Prelude.coerce" `to` " unsafeCoerce" `importing` Just " Unsafe.Coerce"
6971 , " Agda.Builtin.Int.Int" `to` " Integer" `importing` Nothing
7072 , " Agda.Builtin.Word.Word64" `to` " Word" `importing` Nothing
Original file line number Diff line number Diff line change 1+ module ZeroSuc where
2+
3+ open import Haskell.Prelude
4+
5+ test1 : Nat
6+ test1 = zero
7+
8+ {-# COMPILE AGDA2HS test1 #-}
9+
10+ test2 : Nat → Nat
11+ test2 = suc
12+
13+ {-# COMPILE AGDA2HS test2 #-}
14+
15+ data MyNat : Set where
16+ MyZero : MyNat
17+ MySuc : MyNat → MyNat
18+
19+ {-# COMPILE AGDA2HS MyNat #-}
20+
21+ opaque
22+ test3 : MyNat → Nat
23+ test3 MyZero = zero
24+ test3 (MySuc n) = suc (test3 n)
25+
26+ {-# COMPILE AGDA2HS test3 #-}
Original file line number Diff line number Diff line change 1+ module ZeroSuc where
2+
3+ import Numeric.Natural (Natural )
4+
5+ test1 :: Natural
6+ test1 = 0
7+
8+ test2 :: Natural -> Natural
9+ test2 = succ
10+
11+ data MyNat = MyZero
12+ | MySuc MyNat
13+
14+ test3 :: MyNat -> Natural
15+ test3 MyZero = 0
16+ test3 (MySuc n) = succ (test3 n)
17+
You can’t perform that action at this time.
0 commit comments