Skip to content

Commit

Permalink
Define subterms using mendlerPara.
Browse files Browse the repository at this point in the history
🔥 that Functor constraint.
  • Loading branch information
robrix committed Mar 19, 2024
1 parent ad4dba6 commit 1d70d13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions semantic-analysis/src/Analysis/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ instance (Ord (sig (Term sig v)), Ord v) => Ord (Term sig v) where
compare _ _ = GT


subterms :: (Ord (sig (Term sig v)), Ord v, Foldable sig, Functor sig) => Term sig v -> Set.Set (Term sig v)
subterms = paraTerm (Set.singleton . Var) (foldMap (uncurry Set.insert))
subterms :: (Ord (sig (Term sig v)), Ord v, Foldable sig) => Term sig v -> Set.Set (Term sig v)
subterms = mendlerParaTerm (Set.singleton . Var) (\ k -> foldMap (uncurry Set.insert . k))

foldTerm :: Functor sig => (v -> r) -> (sig r -> r) -> (Term sig v -> r)
foldTerm var sig = mendlerTerm var (\ k -> sig . fmap k)
Expand Down

0 comments on commit 1d70d13

Please sign in to comment.