Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Agda2Hs/Compile/Name.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ toNameImport x (Just mod) =
defaultSpecialRules :: SpecialRules
defaultSpecialRules = Map.fromList
[ "Agda.Builtin.Nat.Nat" `to` "Natural" `importing` Just "Numeric.Natural"
, "Agda.Builtin.Nat.Nat.zero" `to` "0" `importing` Nothing
, "Agda.Builtin.Nat.Nat.suc" `to` "succ" `importing` Nothing
, "Haskell.Prelude.coerce" `to` "unsafeCoerce" `importing` Just "Unsafe.Coerce"
, "Agda.Builtin.Int.Int" `to` "Integer" `importing` Nothing
, "Agda.Builtin.Word.Word64" `to` "Word" `importing` Nothing
Expand Down
26 changes: 26 additions & 0 deletions test/Succeed/ZeroSuc.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module ZeroSuc where

open import Haskell.Prelude

test1 : Nat
test1 = zero

{-# COMPILE AGDA2HS test1 #-}

test2 : Nat → Nat
test2 = suc

{-# COMPILE AGDA2HS test2 #-}

data MyNat : Set where
MyZero : MyNat
MySuc : MyNat → MyNat

{-# COMPILE AGDA2HS MyNat #-}

opaque
test3 : MyNat → Nat
test3 MyZero = zero
test3 (MySuc n) = suc (test3 n)

{-# COMPILE AGDA2HS test3 #-}
17 changes: 17 additions & 0 deletions test/Succeed/ZeroSuc.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module ZeroSuc where

import Numeric.Natural (Natural)

test1 :: Natural
test1 = 0

test2 :: Natural -> Natural
test2 = succ

data MyNat = MyZero
| MySuc MyNat

test3 :: MyNat -> Natural
test3 MyZero = 0
test3 (MySuc n) = succ (test3 n)

Loading