This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ module Data.Core
2828, ann
2929, annWith
3030, instantiate
31+ , stripAnnotations
3132) where
3233
3334import Control.Applicative (Alternative (.. ))
@@ -189,6 +190,12 @@ annWith :: (Carrier sig m, Member Core sig) => CallStack -> m a -> m a
189190annWith 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+
192199instance Syntax Core where
193200 foldSyntax go k h = \ case
194201 Let a -> Let a
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ parserSpecs = testGroup "Parsing: simple specs"
100100 ]
101101
102102assert_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
105105parserExamples :: TestTree
106106parserExamples = testGroup " Parsing: Eval.hs examples"
You can’t perform that action at this time.
0 commit comments