Skip to content

Commit 13938ed

Browse files
committed
Implement 'existing' keyword for skipping compilation of a symbol
This is useful for things that are defined in a FOREIGN pragma, either by importing from a Haskell module or as an inline Haskell definition
1 parent bb5f086 commit 13938ed

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/Agda2Hs/Compile.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ compile genv tlm _ def =
117117

118118
case (p , theDef def) of
119119
(NoPragma , _ ) -> return []
120-
(ExistingClassPragma , _ ) -> return []
120+
(ExistingPragma , _ ) -> return []
121+
(ExistingClassPragma , Record{} ) -> return []
121122
(UnboxPragma s , Record{} ) -> [] <$ checkUnboxPragma def
122123
(TransparentPragma , Function{}) -> [] <$ checkTransparentPragma def
123124
(InlinePragma , Function{}) -> [] <$ checkInlinePragma def

src/Agda2Hs/Compile/Utils.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ hasCompilePragma q = processPragma q <&> \case
195195
InlinePragma{} -> True
196196
DefaultPragma{} -> True
197197
ClassPragma{} -> True
198+
ExistingPragma{} -> True
198199
ExistingClassPragma{} -> True
199200
UnboxPragma{} -> True
200201
TransparentPragma{} -> True

src/Agda2Hs/Pragma.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ data ParsedPragma
5151
| InlinePragma
5252
| DefaultPragma [Hs.Deriving ()]
5353
| ClassPragma [String]
54+
| ExistingPragma
5455
| ExistingClassPragma
5556
| UnboxPragma Strictness
5657
| TransparentPragma
@@ -89,6 +90,7 @@ processPragma qn = liftTCM (getUniqueCompilerPragma pragmaName qn) >>= \case
8990
Just (CompilerPragma r s)
9091
| "class" `isPrefixOf` s -> return $ ClassPragma (words $ drop 5 s)
9192
| s == "inline" -> return InlinePragma
93+
| s == "existing" -> return ExistingPragma
9294
| s == "existing-class" -> return ExistingClassPragma
9395
| s == "unboxed" -> return $ UnboxPragma Lazy
9496
| s == "unboxed-strict" -> return $ UnboxPragma Strict

0 commit comments

Comments
 (0)