[Haskell-cafe] Does the lambda calculus have provisions for I/O? State can be done with free variables.
Chris Warburton
chriswarbo at googlemail.com
Thu Aug 14 09:37:35 UTC 2014
KC <kc1956 at gmail.com> writes:
> Hi:
>
> Does the lambda calculus have provisions for I/O?
> State can be done with free variables.
Lambda Calculus can't do IO "internally"; we can't mutate variables,
whether or not they're free.
However, we can use LC to construct programs in some "external"
language, which *does* support IO. We can interface the two by using
free variables to represent the "external" functions.
This is the same way Haskell implements IO: pure Haskell functions are
used to construct a "main" value out of "external" (/"primitive"/
"built-in"/ "foreign") functions. We can regard "main" as a program for
an imperative language (the Haskell run-time system).
We can do the same thing in Lambda Calculus (which is like Haskell
without the type-checking and syntactic sugar).
Cheers,
Chris
More information about the Haskell-Cafe
mailing list