Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  How best to do this? (Michael Peternell)
   2. Re:  How best to do this? (emacstheviking)
   3. Re:  How best to do this? (Brent Yorgey)
   4. Re:  How best to do this? (Ozgur Akgun)
   5. Re:  How best to do this? (Brent Yorgey)
   6. Re:  two System.IO.Strict modules (Patrick Wheeler)


----------------------------------------------------------------------

Message: 1
Date: Wed, 1 May 2013 12:35:36 +0200
From: Michael Peternell <[email protected]>
Subject: Re: [Haskell-beginners] How best to do this?
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

@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 <[email protected]> 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




------------------------------

Message: 2
Date: Wed, 1 May 2013 12:26:12 +0100
From: emacstheviking <[email protected]>
Subject: Re: [Haskell-beginners] How best to do this?
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Message-ID:
        <caeieuuk1swvzcjii3+dh-skmyf01rybysjezmrzgtuewxfk...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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 <[email protected]> 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 <[email protected]>
> 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
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130501/d2c8226c/attachment-0001.htm>

------------------------------

Message: 3
Date: Wed, 1 May 2013 07:33:09 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] How best to do this?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Ah, yes, a warning for literals like [5..2] sounds like an excellent
idea.  Why don't you file a feature request at

  http://hackage.haskell.org/trac/ghc/

?

-Brent

On Wed, May 01, 2013 at 12:35:36PM +0200, Michael Peternell 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 <[email protected]> 
> >> 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
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



------------------------------

Message: 4
Date: Wed, 1 May 2013 19:18:36 +0100
From: Ozgur Akgun <[email protected]>
Subject: Re: [Haskell-beginners] How best to do this?
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Message-ID:
        <CALzazPD_m1VvM15AYWW=xdoodhagfxgy9kru73t2a1a6py1...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Just to note: This sounds like a special case of
http://hackage.haskell.org/trac/ghc/ticket/7870?

Cheers,
Ozgur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130501/c7c4658b/attachment-0001.htm>

------------------------------

Message: 5
Date: Wed, 1 May 2013 19:38:07 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] How best to do this?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

On Wed, May 01, 2013 at 07:18:36PM +0100, Ozgur Akgun wrote:
> Just to note: This sounds like a special case of
> http://hackage.haskell.org/trac/ghc/ticket/7870?

Well, perhaps if #7870 were implemented, one could easily add this
warning message without changing CHG.  But I think adding a warning
for literal expressions like [5..2] is a good idea regardless.

-Brent



------------------------------

Message: 6
Date: Thu, 2 May 2013 03:11:38 -0500
From: Patrick Wheeler <[email protected]>
Subject: Re: [Haskell-beginners] two System.IO.Strict modules
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Message-ID:
        <CAAo_BYaP=Xnp0q0kFiY2e3L=7A6jMX_X7GkFW-HJ=m9qyi6...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

It is also possible to refer to a package explicitly durring import with
the PackageImports language pragma.  You can read about it in the ghc
manual[1].

Patrick

[1]
http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/syntax-extns.html#package-imports

On Fri, Apr 26, 2013 at 10:10 PM, Hong Yang <[email protected]> wrote:

> Thanks.
>
>
> On Fri, Apr 26, 2013 at 8:33 AM, Brandon Allbery <[email protected]>wrote:
>
>> On Thu, Apr 25, 2013 at 11:12 PM, Hong Yang <[email protected]> wrote:
>>
>>> There are two modules called the same name: System.IO.Strict, documented
>>> respectively at
>>>
>>> http://hackage.haskell.org/packages/archive/strict-io/0.2.1/doc/html/System-IO-Strict.html
>>>     http://hackage.haskell.org/package/strict-0.3.2
>>>
>>> My questions are:
>>>
>>> 1)    Will these two modules coexist in the same version of GHC? Or put
>>> it another way, both modules' .tar.gz files have System/IO/Strict.hs
>>> inside, will they overlap in physical disk? From where can I tell which
>>> locations they will be installed to?
>>>
>>
>> Each module gets its own directory tree under /usr/lib/ghc or ~/.ghc.
>>
>>
>>> 2)    If yes, which module will "import System.IO.Strict" actually use?
>>>
>>
>> This is a bit harder; it will try to pick one, but I don't know the
>> rules. Ultimately it's best to use -package parameters to tell it which
>> package to take it from.
>>
>> This is where building with cabal-install helps, as you specify the
>> package to use in the manifest and only the packages listed in the manifest
>> will be visible to ghc.
>>
>> --
>> brandon s allbery kf8nh                               sine nomine
>> associates
>> [email protected]
>> [email protected]
>> unix, openafs, kerberos, infrastructure, xmonad
>> http://sinenomine.net
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>


-- 
Patrick Wheeler
[email protected]
[email protected]
[email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130502/ed63d223/attachment.htm>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 59, Issue 2
****************************************

Reply via email to