Strange type representation bug with phantom type synonyms in interactive mode
Sorry for the confusing summary
The following module defines a phatom type synonym and a simple function
module Phantom where
type PhantomSyn a = Int
f = (\_ -> 2) :: PhantomSyn a -> Int
When running in interactive mode (the bug doesn't seem to be reproducible otherwise) the typechecker gives a strange error
./ghc-inplace --interactive /tmp/Phantom.hs
GHCi, version 6.9.20071025: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
[1 of 1] Compiling Phantom ( /tmp/Phantom.hs, interpreted )
Ok, modules loaded: Phantom.
*Phantom> f "incorrectParam"
<interactive>:1:2:
Couldn't match expected type `PhantomSyn GHC.Prim.Any'
against inferred type `[Char]'
Expected type: PhantomSyn GHC.Prim.Any
Inferred type: [Char]
In the first argument of `f', namely `"incorrectParam"'
In the expression: f "incorrectParam"
The typechecker should output
Expected type: PhantomSyn a
If I skip the interactive mode (including the erroneous declaration in the Phantom.hs itself) or I define f as
f :: PhantomSyn a -> Int
f = (\_ -> 2)
The incorrect error report disappears.
Trac metadata
Trac field | Value |
---|---|
Version | 6.9 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |