Silent name shadowing
I have code like:
let baseTex =
(getTexPropNode nodes . NC.properties . NC.av $ geometry)
>>= baseTex
>>= (flip Map.lookup texs) . NC.tdSource
which gives me error:
Games/secunda/Graph.hs:224:23:
Couldn't match expected type `TexProperty -> Maybe a0'
with actual type `Maybe b0'
In the second argument of `(>>=)', namely `baseTex'
In the first argument of `(>>=)', namely
`(getTexPropNode nodes . NC.properties . NC.av $ geometry)
>>= baseTex'
In the expression:
(getTexPropNode nodes . NC.properties . NC.av $ geometry)
>>= baseTex
>>= (flip Map.lookup texs) . NC.tdSource
However if I try to get type of expressin on the right hand side of let baseTex = ... in ghci then I get no error. Problem is that I am importing module with function baseTex :: TexProperty -> Maybe TexDesc and that function is shadowed by let expression which should have type of Maybe Texture.
I tried to use ghc-options: -Wall -fwarn-name-shadowing in Cabal with no effect.
From above error I conclude, that I made a type error. So I try to get type of expression in ghci which results in correct type - that makes my confusion. While I am trying to concentrate on type error, I am missing that I shadowed function by variable.
This is not for the first time I've done same mistake. I would appreciate to get warnings about name shadowing since they makes me belief that I am using names of different type.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |