KC | 13 Aug 23:39 2014
Picon

Does the lambda calculus have provisions for I/O? State can be done with free variables.

Hi:

Does the lambda calculus have provisions for I/O?
State can be done with free variables.

--

--

Sent from an expensive device which will be obsolete in a few months! :D

Casey

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Chris Warburton | 14 Aug 11:37 2014

Re: Does the lambda calculus have provisions for I/O? State can be done with free variables.

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

Gmane