What about a new compiler flag to highlight all such potential gotchas?

  --n00b

;)
Would help me out no end...

On 1 May 2013 11:35, Michael Peternell <michael.peternell@gmx.at> wrote:
@Brent:
By reading your mails I got an idea...

how about generating a compiler warning when someone types a literal like [5..2].

"Foo.hs:32: Warning: Literal list [5..2] evaluates to [] because 5 > 2 and the default step size is +1. Replace the literal with the empty list or with [5,4..2] to suppress this warning."

That would be a really beginner-friendly warning.

But I also think that we shouldn't catch this kind of mistake at runtime, because it may be the expected behavior in many cases.

Michael

Am 29.04.2013 um 23:54 schrieb Brent Yorgey:

> Oh, yes, I suppose it could.
>
> In any case, I am still in favor of the existing semantics -- it is
> simple and consistent (and sometimes even useful).  "Do what I
> mean"-style semantics with special cases end up generating more pain
> than they solve.
>
> -Brent
>
> On Mon, Apr 29, 2013 at 02:29:43PM -0400, David McBride wrote:
>> Couldn't it just use fromEnum and compare the integers you get and
>> figure out which is bigger?
>>
>> On Mon, Apr 29, 2013 at 2:17 PM, Brent Yorgey <byorgey@seas.upenn.edu> wrote:
>>> But then \x y -> [x .. y]  would have to have the type
>>>
>>>  (Ord a, Enum a) => [a]
>>>
>>> whereas now it just has the Enum constraint.  Either that or else the
>>> notation would work differently for literals vs. expressions but that
>>> would be just awful.
>>>
>>> -Brent


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners