Discussion: Can we make evaluate easier to find?

John Lato jwlato at gmail.com
Thu Jan 8 17:25:51 UTC 2015


It's a bit orthogonal, but since you brought up lazy IO I thought it was
worth mentioning, as shallow evaluation is insufficient.

On 09:15, Thu, Jan 8, 2015 David Feuer <david.feuer at gmail.com> wrote:

> deepseq is somewhat orthogonal:
>
> shallow: v $! return v
> deep: v $!! return v
> shallow: evaluate v >>= return
> deep: evaluate (force v) >>= return
>
> On Thu, Jan 8, 2015 at 12:11 PM, John Lato <jwlato at gmail.com> wrote:
> > AKAIK neither one is necessarily safe. You need something like deepseq to
> > fully evaluate the lazy structure.
> >
> > If you are sure that evaluation to WHNF is sufficient for performing all
> > lazy IO, then I think either evaluate or ($!) will work.
> >
> > evaluate is probably to be preferred if IO is available, similar to
> throw vs
> > throwIO.  However I think idioms with seq and ($!) are so common that
> they
> > need to be supported too. After all, you may have just a 'Monad m'
> context.
> >
> > John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20150108/2f997177/attachment.html>


More information about the Libraries mailing list