Skip to content

Commit

Permalink
[ fix #302 ] Move _/=_ function out of the Eq record
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx committed May 24, 2024
1 parent 4e66970 commit f17b86c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/Haskell/Prim/Eq.agda
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ open import Haskell.Prim.Either
-- Eq

record Eq (a : Set) : Set where
infix 4 _==_ _/=_
infix 4 _==_
field
_==_ : a a Bool

_/=_ : a a Bool
x /= y = not (x == y)

open Eq ⦃...⦄ public

{-# COMPILE AGDA2HS Eq existing-class #-}

_/=_ : {{Eq a}} a a Bool
x /= y = not (x == y)

infix 4 _/=_

instance
iEqNat : Eq Nat
iEqNat ._==_ = eqNat
Expand Down
2 changes: 2 additions & 0 deletions test/AllTests.agda
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import Issue145
import Issue264
import Issue301
import Issue305
import Issue302

{-# FOREIGN AGDA2HS
import Issue14
Expand Down Expand Up @@ -161,4 +162,5 @@ import Issue145
import Issue264
import Issue301
import Issue305
import Issue302
#-}
5 changes: 5 additions & 0 deletions test/Issue302.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
open import Haskell.Prelude

not0 : Int Bool
not0 n = n /= 0
{-# COMPILE AGDA2HS not0 #-}
1 change: 1 addition & 0 deletions test/golden/AllTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ import Issue145
import Issue264
import Issue301
import Issue305
import Issue302

5 changes: 5 additions & 0 deletions test/golden/Issue302.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Issue302 where

not0 :: Int -> Bool
not0 n = n /= 0

0 comments on commit f17b86c

Please sign in to comment.