debugger does not know the correct type for a newtype field
This bug is in 7.4.1. I think it was also in 7.0.3. It is also in the current head:[[BR]] commit 921530b4[[BR]] Date: Tue May 15 10:32:58 2012 +0100
Here is the console log. Notice that the type of allItems is resolved as TWrapper but it should be [Int]. Expressions in conditional breakpoints are failing because of this.
18:06 tm=3:2 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1035> cat bindings-bug.hs
newtype TWrapper = Wrapper
{ mItems :: [Int]
} deriving Show
main = print $ test $ Wrapper [1]
test Wrapper{ mItems = allItems } = id $
let headItem = head allItems in
headItem
18:06 tm=0 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1036> ../../ghc/stage2/build/tmp/ghc-stage2 -B. --interactive bindings-bug.hs
GHCi, version 7.5.20120515: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( bindings-bug.hs, interpreted )
Ok, modules loaded: Main.
*Main> :break 7 37
Breakpoint 0 activated at bindings-bug.hs:(7,37)-(9,10)
*Main> :main
Stopped at bindings-bug.hs:(7,37)-(9,10)
_result :: Int = _
allItems :: TWrapper = _
[bindings-bug.hs:(7,37)-(9,10)] *Main> :list
6
vv
7 test Wrapper{ mItems = allItems } = id $
8 let headItem = head allItems in
9 headItem
^^
10
[bindings-bug.hs:(7,37)-(9,10)] *Main> head allItems
<interactive>:5:6:
Couldn't match expected type `[a0]' with actual type `TWrapper'
In the first argument of `head', namely `allItems'
In the expression: head allItems
In an equation for `it': it = head allItems
[bindings-bug.hs:(7,37)-(9,10)] *Main> :continue
1
*Main> :quit
Leaving GHCi.
18:06 tm=42 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1037>
Trac metadata
Trac field | Value |
---|---|
Version | 7.5 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Linux |
Architecture | x86_64 (amd64) |