Idris2/tests/idris2/evaluator/spec001/Desc2.idr
2023-09-07 14:57:22 +01:00

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