2 ms·
There's a nice Haskell library for dealing with combinators, where the types of most functions are intuitive enough to understand what they do: http://hackage.h
by mFixman 8y ago
There's a nice Haskell library for dealing with combinators, where the types of most functions are intuitive enough to understand what they do: http://hackage.haskell.org/package/data-aviary-0.4.0/docs/Data-Aviary-Birds.html http://hackage.haskell.org/package/data-aviary-0.4.0/docs/Da...
The Y combinator isn't there and can't be defined trivially since Haskell only allows non-recursive data types. However, there's a nice solution using non-monotonic data types[1]:
newtype Mu a = Mu (Mu a -> a)
y f = (\h -> h $ Mu h) (\x -> f . (\(Mu g) -> g) x $ x)
[1] https://stackoverflow.com/a/5885270/305597 https://stackoverflow.com/a/5885270/305597