mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-21 02:31:50 +03:00
10 lines
230 B
Idris
10 lines
230 B
Idris
data Mu : (f : Type -> Type) -> Type where
|
|
MkMu : f (Mu f) -> Mu f
|
|
|
|
%spec a, f, fun
|
|
fold : (fun : Functor f) => (f a -> a) -> Mu f -> a
|
|
fold alg (MkMu t) = alg (fold {a, f, fun} alg <$> t)
|
|
|
|
size : Mu List -> Nat
|
|
size = fold sum
|