[GHC] #12240: Common Sense for Type Classes
GHC
ghc-devs at haskell.org
Wed Jun 29 03:49:51 UTC 2016
#12240: Common Sense for Type Classes
-------------------------------------+-------------------------------------
Reporter: Mathnerd314 | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Mathnerd314):
Functional dependencies imply too much structure. Consider
{{{#!hs
{-# LANGUAGE MultiParamTypeClasses #-}
class C a b
instance C Int Bool
instance C Int Char
instance C Word8 String
instance C Word16 String
}}}
If we have `instance C a Bool`, we know that `a ~ Int`. But if we have
`instance C Word8 b`, we know `b ~ String`. Functional dependencies cannot
express this logic, but it is still "common sense logic".
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12240#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list