Skip to content

Instantly share code, notes, and snippets.

@LSLeary
Last active August 20, 2025 09:05
Show Gist options
  • Save LSLeary/4c7f3ab7622d991cfa22c36efbaf0674 to your computer and use it in GitHub Desktop.
Save LSLeary/4c7f3ab7622d991cfa22c36efbaf0674 to your computer and use it in GitHub Desktop.
{-# LANGUAGE BlockArguments #-}
module Y where
newtype Y a = Y { ($$) :: Y a -> a }
{-# NOINLINE y #-}
y :: (a -> a) -> Y a
y f = Y \x -> f (x $$ x)
yfix :: (a -> a) -> a
yfix f = y f $$ y f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment