[GHC] #8634: Relax functional dependency coherence check ("liberal coverage condition")

GHC ghc-devs at haskell.org
Mon Jul 21 13:09:13 UTC 2014


#8634: Relax functional dependency coherence check ("liberal coverage condition")
-------------------------------------+-------------------------------------
              Reporter:  danilo2     |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:  7.10.1
              Priority:  high        |           Version:  7.7
             Component:  Compiler    |          Keywords:
            Resolution:              |  Operating System:  Unknown/Multiple
Differential Revisions:  Phab:D69    |   Type of failure:  None/Unknown
          Architecture:              |         Test Case:
  Unknown/Multiple                   |          Blocking:
            Difficulty:  Unknown     |
            Blocked By:              |
       Related Tickets:  #1241,      |
  #2247, #8356, #9103, #9227         |
-------------------------------------+-------------------------------------

Comment (by danilo2):

 I've got a single question related to this topic - lets assume I've got a
 simple code:

 {{{#!haskell
 {-# LANGUAGE NoMonomorphismRestriction #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE DysfunctionalDependencies #-}

 class CTest a b | a -> b where
    ctest :: a -> b

 data X = X

 instance Monad m => CTest X (m Int) where
     ctest _ = return 5

 main = do
     let f = ctest X
     -- ... some code here
     print "end"
 }}}

 Is it possible in such example, that anything would break using the
 `-XDysfunctionalDependencies` (assuming, that all instances mention
 concrete types for `a`, like the one on the example, which mentions `X` in
 place of `a`)? This is the exact case we need to use it right now (of
 course very simplified). For now it works very well even for large
 examples. When such code "could" break and give us unpredictable results?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8634#comment:27>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list