#4894: Missing improvement for fun. deps.
----------------------------------------+-----------------------------------
    Reporter:  diatchki                 |        Owner:              
        Type:  bug                      |       Status:  new         
    Priority:  normal                   |    Milestone:              
   Component:  Compiler (Type checker)  |      Version:  7.1         
    Keywords:                           |     Testcase:              
   Blockedby:                           |   Difficulty:              
          Os:  Unknown/Multiple         |     Blocking:              
Architecture:  Unknown/Multiple         |      Failure:  None/Unknown
----------------------------------------+-----------------------------------
Changes (by simonpj):

 * cc: dimitris@… (added)


Comment:

 No, GHC has no way to do this. Not because of shortcomings in the
 inference engine, but because the FC language can't express it.  The
 question is this: where is the *evidence* that `(b~c)`. Alas there isn't
 any.

 This is a place where the "encoding" of fundeps using type functions
 actually works better:
 {{{
 class (b ~ B a) => F a b where
   type B a

 instance F Int Int where
   type B Int = Int
 }}}
 Now if you have given constraints (ie evidence for) `F a b, F a c)`, then
 you also have evidence for `b ~ B a, c ~ B a`, and hence by transitivity
 for `b~c`.

 Fundeps in GHC are handled just as in Hugs, as "improvement rules" only,
 meaning that they narrow the search space by suggesting unifications.  But
 they don't provide evidence.

 Having equalities as superclasses isn't working properly yet, but it's my
 current priority.

 Does this make sense?

 Simon

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to