Last active
May 23, 2022 23:18
-
-
Save LSLeary/f6ab06b3a7b0a78104f385c5b8f540ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE PolyKinds, RankNTypes, TypeOperators #-} | |
module IFix where | |
newtype IFix f t = IFix (f (IFix f) t) | |
type f ~> g = forall x. f x -> g x | |
class NFunctor f where | |
nmap :: g ~> h -> f g ~> f h | |
cata :: NFunctor f => f g ~> g -> IFix f ~> g | |
cata alg (IFix f) = alg (nmap (cata alg) f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment