Wrong warning given ViewPatterns and -Wmonomorphism-restriction
I understand ghc complaining about b
, but not about a
.
No warnings when view patterns are not used.
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS -Wmonomorphism-restriction #-}
module Foo where
{-
demo.hs:11:9: warning: [-Wmonomorphism-restriction]
• The Monomorphism Restriction applies to the bindings for ‘a’, ‘b’
Consider giving them a type signature
• In the expression: let Foo a (round -> b) = f in a + b
In an equation for ‘bar’:
bar f = let Foo a (round -> b) = f in a + b
|
11 | let Foo a (round -> b) = f
| ^^^^^^^^^^^^^^^^^^^^^^
-}
data Foo = Foo Int Double
bar :: Foo -> Int
bar f =
let Foo a (round -> b) = f
in a + b
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |