[GHC] #8522: exprType incorrect for let expressions which bind types

GHC ghc-devs at haskell.org
Mon Nov 11 20:16:14 UTC 2013


#8522: exprType incorrect for let expressions which bind types
------------------------------------+-------------------------------------
       Reporter:  afarmer           |             Owner:
           Type:  bug               |            Status:  new
       Priority:  high              |         Milestone:
      Component:  Compiler          |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 The `exprType` function in CoreUtils doesn't handle let expressions which
 bind type variables correctly. Consider:

 {{{
 let a = Int
 in \ $dNum x y -> (+) a $dNum x y
 }}}

 `exprType` on this expression will give: `Num a => a -> a -> a` instead of
 `Num Int => Int -> Int -> Int`

 Obviously the core lint checker does the right thing, so I modified
 exprType (see attached patch) to do what it does. I'm guessing that
 exprType isn't used in any crucial capacity (or let-bound types are not
 that common) or the fact that `a` is unbound in the result would be a big
 problem. That said, we use this function heavily in HERMIT... is there
 another we should be using instead?

 Any chance this can make the 7.8 window?

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


More information about the ghc-tickets mailing list