3 ms·
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 (>>=).
by edflsafoiewq 2y ago
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 (>>=).
- solomonb 2y agoYou 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.
- Athas 2y agoThis 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.
- chombier 2y agoNot 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.