[Haskell-cafe] Lazy series [was : Preventing sharing]

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Jan 9 18:11:48 UTC 2016


On Sat, Jan 09, 2016 at 07:04:17PM +0100, Arjen wrote:
> If I'm not mistaken, a strict language implies that arguments are
> evaluated before function calls.  To calculate exps, you need to add 1 to
> the result of the function call integral on argument exps.

Sure, but why should evaluating exps actually do anything?  If exps is of
function type then evaluating it need not do anything at all!

> To evaluate that call, it first evaluates the arguments: exps.  And so
> on...  This causes a non-terminating calculation, I would expect.

I disagree, for the reason above.

> IMHO, unless you add explicit laziness to a strict language, which
> some do but it requires some extra syntax, this cannot be done.

You don't even need explicit laziness.  Having exps be of function type will
do.  That means evaluating it will terminate early.

> If you propose that a function (or anything with a function type) is
> implicitly lazy, then I think that you are describing a
> lazy/non-strict language.

I'm not sure what you're getting at here.  I'm not proposing that function
application is evaluated lazily, I'm claiming that functions themselves are
lazy datatypes since they contain computations that are only run when you
applying them to arguments.

Tom


More information about the Haskell-Cafe mailing list