Ticket #1813 (closed merge: fixed)
Strange type representation bug with phantom type synonyms in interactive mode
| Reported by: | guest | Owned by: | igloo |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.10 branch |
| Component: | GHCi | Version: | 6.9 |
| Keywords: | Cc: | alfonso.acosta@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | tcfail186 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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.
Change History
Note: See
TracTickets for help on using
tickets.
