Useful set of -W switches for .ghci?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Useful set of -W switches for .ghci?

Александър Л. Димитров
Hey list,

I'm currently using :set -Wall in my .ghci to enforce some good coding practices
on my side. Something like missing type signatures and the like. It has saved me
quite a lot of hassle over the last couple of days as I experimented more with
Haskell. But it seems, -Wall may be just a little too? overzealous:

Prelude> 2^2

    Warning: Defaulting the following constraint(s) to type `Integer'
             `Num t' arising from a use of `^' at <interactive>:1:0-2

    Warning: Defaulting the following constraint(s) to type `Integer'
             `Integral t' arising from a use of `^' at <interactive>:1:0-2

    Warning: Defaulting the following constraint(s) to type `Integer'
             `Num t' arising from a use of `^' at <interactive>:1:0-2

    Warning: Defaulting the following constraint(s) to type `Integer'
             `Integral t' arising from a use of `^' at <interactive>:1:0-2
4

(I've shortened ghci's response a bit)

So, do you have a good (recommended) set of -W switches for a newbie playing
around in GHCi, so I can learn a good style? Forgive me if it's somewhere on
page one of some book or tutorials - I've read so many of both, I'm beginning to
forget things.

Thanks,
Aleks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/beginners/attachments/20081205/6b8ef7aa/attachment.bin
Reply | Threaded
Open this post in threaded view
|

Useful set of -W switches for .ghci?

Daniel Fischer-4
Am Freitag, 5. Dezember 2008 19:03 schrieb ?????????? ?. ????????:

> Hey list,
>
> I'm currently using :set -Wall in my .ghci to enforce some good coding
> practices on my side. Something like missing type signatures and the like.
> It has saved me quite a lot of hassle over the last couple of days as I
> experimented more with Haskell. But it seems, -Wall may be just a little
> too? overzealous:
>
> Prelude> 2^2
>
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Num t' arising from a use of `^' at <interactive>:1:0-2
>
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Integral t' arising from a use of `^' at <interactive>:1:0-2
>
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Num t' arising from a use of `^' at <interactive>:1:0-2
>
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Integral t' arising from a use of `^' at <interactive>:1:0-2
> 4
>
> (I've shortened ghci's response a bit)
>
> So, do you have a good (recommended) set of -W switches for a newbie
> playing around in GHCi, so I can learn a good style? Forgive me if it's
> somewhere on page one of some book or tutorials - I've read so many of
> both, I'm beginning to forget things.
>

Turn off those warnings you don't want, like

$ ghci -Wall -fno-warn-type-defaults
GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> 2^2
4

A list of warning options is in section 5.7 of the user's guide (unless it's
moved in the 6.10 branch).

> Thanks,
> Aleks

Cheers,
Daniel

Reply | Threaded
Open this post in threaded view
|

Useful set of -W switches for .ghci?

Александър Л. Димитров
Also Sprach Daniel Fischer:

> Turn off those warnings you don't want, like
>
> $ ghci -Wall -fno-warn-type-defaults
> GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
> Loading package base ... linking ... done.
> Prelude> 2^2
> 4
>
> A list of warning options is in section 5.7 of the user's guide (unless it's
> moved in the 6.10 branch).

Thanks very much, the location seems to be the same,
Aleks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/beginners/attachments/20081206/141af60b/attachment-0001.bin