mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
cata over Fix.
This commit is contained in:
parent
793025e65f
commit
ea6fd75131
@ -108,5 +108,8 @@ type Row a = Both (Line a)
|
||||
-- | A fixpoint over a functor.
|
||||
newtype Fix f = Fix { unFix :: f (Fix f) }
|
||||
|
||||
cata :: Functor f => (f a -> a) -> Fix f -> a
|
||||
cata f = f . fmap (Alignment.cata f) . unFix
|
||||
|
||||
ana :: Functor f => (a -> f a) -> a -> Fix f
|
||||
ana f = Fix . fmap (ana f) . f
|
||||
|
Loading…
Reference in New Issue
Block a user