Skip to content

Commit dba6d18

Browse files
committed
[ fix agda#373 ] enable existing-class on postulated type formers
1 parent 0412c42 commit dba6d18

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

src/Agda2Hs/Compile/Utils.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ isClassName q = getConstInfo' q >>= \case
173173
ClassPragma _ -> True
174174
ExistingClassPragma -> True
175175
_ -> False
176+
Right Defn{defName = r, theDef = Axiom{}} -> processPragma r <&> (ExistingClassPragma ==)
176177
_ -> return False
177178

178179
-- | Check if the given type corresponds to a class constraint in Haskell.

test/AllTests.agda

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ import CustomTuples
9292
import ProjectionLike
9393
import FunCon
9494
import Issue308
95+
import Issue373
9596

9697
{-# FOREIGN AGDA2HS
9798
import Issue14
@@ -181,4 +182,5 @@ import CustomTuples
181182
import ProjectionLike
182183
import FunCon
183184
import Issue308
185+
import Issue373
184186
#-}

test/Issue373.agda

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module Issue373 where
2+
3+
open import Haskell.Prelude
4+
5+
{-# FOREIGN AGDA2HS
6+
7+
class MyShow a where
8+
myshow :: a -> String
9+
10+
#-}
11+
12+
postulate
13+
MyShow : Set Set
14+
myshow : {{ MyShow a }} a String
15+
16+
{-# COMPILE AGDA2HS MyShow existing-class #-}
17+
18+
anothershow : {{ MyShow a }} a String
19+
anothershow = myshow
20+
21+
{-# COMPILE AGDA2HS anothershow #-}

test/golden/Issue373.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Issue373 where
2+
3+
class MyShow a where
4+
myshow :: a -> String
5+
6+
anothershow :: MyShow a => a -> String
7+
anothershow = myshow
8+

0 commit comments

Comments
 (0)