Hacker News new | past | comments | ask | show | jobs | submit login

Note that this is same desugaring for normal let

  let x = y in F   <===>   (\x.F)(y)
just replacing function application with a different function (>>=).





This is not the case in Haskell, because let-bindings can be self-referential, while lambdas cannot (without using a fixed point combinator). Also, in most functional languages, a let-binding causes type generalisation, which is not the case for a lambda.

Not exactly the same: `x` is given a polymorphic type (in F) in Haskell (restricted to values in ML) whereas the unannotated let-over-lambda will give `x`a monomorphic type.

You can desugar let bindings that way but often times (as I believe is the case in GHC) you have a `Let` term in your AST.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: