[GHC] #10338: GHC Forgets Constraints

GHC ghc-devs at haskell.org
Thu Apr 23 19:34:52 UTC 2015


#10338: GHC Forgets Constraints
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.3
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 But that's very reasonable isn't it? What type do you expect to be
 inferred for `fromScalar'`?  Well, you get a constraint `T t r` arising
 from the call to `fromScalar` in its RHS, and GHC solves that constraint
 using the instance declaration, so we get the inferred type
 {{{
 fromScalar' :: (Functor t, Num r) => r -> t r
 }}}
 And now you can see why you get the complaint when it's called in
 `convert`.

 What did you think would happen?

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


More information about the ghc-tickets mailing list