Skip to content

exprType incorrect for let expressions which bind types

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?

Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information