[Haskell-cafe] [] == []

Rustom Mody rustompmody at gmail.com
Tue Mar 10 03:20:03 UTC 2015


On Tue, Mar 10, 2015 at 8:21 AM, Lyndon Maydwell <maydwell at gmail.com> wrote:

> GHC 7.8.3 here.
>
> Hmm, on second inspection I believe that the Bool reference is to the
> top-level expression, not the list items after all.
>
> I don't seem to get any defaulting behaviour either when not using GHCi.
> This seems to indicate that the extended interactive type defaulting is
> coming into play:
>
>
> https://downloads.haskell.org/~ghc/7.8.2/docs/html/users_guide/interactive-evaluation.html
>
> I'd guess that this means that the () default is being used. -Wall seems
> to indicate that this is in-fact the case:
>
>
> [Prelude] λ [] == []
>
> <interactive>:2:4: Warning:
>     Defaulting the following constraint(s) to type ‘()’
>       (Eq t0) arising from a use of ‘==’
>     In the expression: [] == []
>     In an equation for ‘it’: it = [] == []
> True
>
>
> Hope this helps.
>
>
Thats better -- thanks Lyndon!

So after some fishing around I find the more pointed warning I am after is
-fwarn-type-defaults

The docs seem confusing though:

https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/options-sanity.html

Under -fwarn-type-defaults:
says

*Have the compiler warn/inform you where in your source the Haskell
defaulting mechanism for numeric types kicks in.*

Wheres the numeric here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150310/0827f779/attachment.html>


More information about the Haskell-Cafe mailing list