Opened 10 years ago

Closed 10 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:



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 10 years ago by simonpj

difficulty: Unknown
Resolution: invalid
Status: newclosed

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]'.


Note: See TracTickets for help on using tickets.