Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#8522 closed bug (fixed)

exprType incorrect for let expressions which bind types

Reported by: afarmer Owned by:
Priority: high Milestone:
Component: Compiler Version: 7.6.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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?

Attachments (1)

Fix-exprType-s-handling-of-let-bound-types.patch (1.1 KB) - added by afarmer 5 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 months ago by afarmer

  • Status changed from new to patch

comment:2 Changed 5 months ago by Simon Peyton Jones <simonpj@…>

In 96e6eddc40c34a171f6261a7814a1e264457ce86/ghc:

Make exprType work correctly in the presnce of type bindings (Trac #8522)

comment:3 Changed 5 months ago by simonpj

OK done. I've implemented it slightly differently

Last edited 5 months ago by simonpj (previous) (diff)

comment:4 Changed 5 months ago by simonpj

  • Resolution set to fixed
  • Status changed from patch to closed

It's not easy to make a test case, so closing.

Simon

Note: See TracTickets for help on using tickets.