Opened 7 years ago

Closed 7 years ago

#2178 closed bug (invalid)

GHC.Prim.Any replaces forall-bound type variables in GHCi

Reported by: japple Owned by:
Priority: normal Milestone:
Component: GHCi Version: 6.8.2
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Load

see :: IO (a -> b)
see = return $ undefined

in GHCi

*Main> g <- see
*Main> :t g
g :: GHC.Prim.Any -> GHC.Prim.Any

Change History (1)

comment:1 Changed 7 years ago by simonpj

  • difficulty set to Unknown
  • Resolution set to invalid
  • Status changed from new to closed

Looks fine to me. 'see' has type 'forall a,b. IO (a->b)'. You bind it, so 'g' must have type 't1 -> t2' for some types 't1' and 't2'. There is no generalisation in a bind, so GHC must choose some types for 't1' and 't2'... and it has.

It's essential for soundness that we don't generalise in a bind, otherwise we'd get the ML polymorphic reference problem. If you say

  r <- newIORef []

you do not want 'r :: forall a. IORef [a]'.

Simon

Note: See TracTickets for help on using tickets.