#1813: Strange type representation bug with phantom type synonyms in interactive
mode
----------------------+-----------------------------------------------------
  Reporter:  guest    |          Owner:         
      Type:  bug      |         Status:  new    
  Priority:  normal   |      Milestone:         
 Component:  GHCi     |        Version:  6.9    
  Severity:  normal   |       Keywords:         
Difficulty:  Unknown  |             Os:  Unknown
  Testcase:           |   Architecture:  Unknown
----------------------+-----------------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1813>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to