Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 36827bb

Browse files
committed
Strip annotations in the tests.
1 parent 8aacefb commit 36827bb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

semantic-core/src/Data/Core.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module Data.Core
2828
, ann
2929
, annWith
3030
, instantiate
31+
, stripAnnotations
3132
) where
3233

3334
import Control.Applicative (Alternative (..))
@@ -189,6 +190,12 @@ annWith :: (Carrier sig m, Member Core sig) => CallStack -> m a -> m a
189190
annWith callStack = maybe id (fmap send . Ann) (stackLoc callStack)
190191

191192

193+
stripAnnotations :: (Member Core sig, Syntax sig) => Term sig a -> Term sig a
194+
stripAnnotations = iter id alg Var Var
195+
where alg t | Just c <- prj t, Ann _ b <- c = b
196+
| otherwise = Term t
197+
198+
192199
instance Syntax Core where
193200
foldSyntax go k h = \case
194201
Let a -> Let a

semantic-core/test/Spec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ parserSpecs = testGroup "Parsing: simple specs"
100100
]
101101

102102
assert_roundtrips :: File (Term Core User) -> Assertion
103-
assert_roundtrips (File _ core) = parseEither Parse.core (showCore core) @?= Right core
103+
assert_roundtrips (File _ core) = parseEither Parse.core (showCore core) @?= Right (stripAnnotations core)
104104

105105
parserExamples :: TestTree
106106
parserExamples = testGroup "Parsing: Eval.hs examples"

0 commit comments

Comments
 (0)