[Haskell-cafe] Odd list comprehension behaviour

Wilfried van Asten sniperrifle2004 at gmail.com
Thu Mar 17 13:16:11 UTC 2016


I haven't found a clear and reasonable example yet, but I am certain that a
non default enumFromThenTo could generate the bound several times (or only
one time), and then later on generate a next that is higher (I think that
modulo arithmetic in enumFromThenTo might do it?). This would certainly be
unorthodox, but it is hypothetically possible. In this case the stop only
when the bound would be exceeded next is more reasonable in my opinion.

Kind regards,

Wilfried van Asten

Op do 17 mrt. 2016 om 06:48 schreef Francesco Ariis <fa-ml at ariis.it>:

> On Wed, Mar 16, 2016 at 11:57:39PM -0430, Manuel Gómez wrote:
> > On Wed, Mar 16, 2016 at 10:56 PM, Francesco Ariis <fa-ml at ariis.it>
> wrote:
> > > The important bit being "the list terminates when the next element
> would
> > > be greater than e3". Unfortunate in my opinion (I agree with you the
> > > fact that `[1..1] /= [1,1..1]` is puzzling), but specs compliant
> > >
> > > [1] https://www.haskell.org/onlinereport/basic.html
> >
> > I'm not necessarily proposing this, but would it not be also
> > reasonable for this to read "the list terminates when the current
> > element equals e3 or the next element would be greater than e3"?  It's
> > slightly more wordy, but it captures the intuition that [a,b..c] ends
> > at c.
>
> Exactly! I am now tempted to fire in haskell-prime.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160317/1d7b394b/attachment.html>


More information about the Haskell-Cafe mailing list