[Haskell-cafe] Confused about type seen in the wild

Felipe Lessa felipe.lessa at gmail.com
Thu Apr 10 17:43:00 UTC 2014


Em 10-04-2014 13:27, Albert Y. C. Lai escreveu:
> Yes, GHC accepts "X => Y => Z" and makes it "(X, Y) => Z". In fact, go
> wilder:
> 
> whee :: Show a => Eq a => a => Bool
> whee x = x == x && null (show x)
> 
> It is valid and it means (Show a, Eq a) => a -> Bool. Try it!
> 
> My understanding is that when the type checker has to support all those
> generalizations like ConstraintKind, DataKinds, etc etc, it becomes so
> general that some traditional distinctions vanish.

What?  Shouldn't that be a bug?

$ ghci -XHaskell98
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> let f :: a => a; f = id

<interactive>:2:15:
    Predicate `a' used as a type
    In the type signature for `f': f :: a => a
Prelude> let f :: Eq a => a => a; f = id

Not even with Haskell98 turned on!

-- 
Felipe.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140410/1892e433/attachment.sig>


More information about the Haskell-Cafe mailing list