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

Commit 07a5740

Browse files
committed
Define foldTerm using mendlerTerm.
1 parent bcca57a commit 07a5740

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

semantic-analysis/src/Analysis/Syntax.hs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ subterms :: (forall t . Eq t => Eq (sig t), forall t . Ord t => Ord (sig t), Ord
3434
subterms = paraTerm (Set.singleton . Var) (foldMap (uncurry Set.insert))
3535

3636
foldTerm :: Functor sig => (v -> r) -> (sig r -> r) -> (Term sig v -> r)
37-
foldTerm var sig = go
38-
where
39-
go (Var v) = var v
40-
go (Term s) = sig (go <$> s)
37+
foldTerm var sig = mendlerTerm var (\ k -> sig . fmap k)
4138

4239
paraTerm :: Functor sig => (v -> r) -> (sig (Term sig v, r) -> r) -> (Term sig v -> r)
4340
paraTerm var sig = go

0 commit comments

Comments
 (0)