Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 3,615
    • Issues 3,615
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 206
    • Merge Requests 206
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Security & Compliance
    • Security & Compliance
    • Dependency List
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15944

Closed
Open
Opened Nov 23, 2018 by pacak@trac-pacak
  • Report abuse
  • New issue
Report abuse New issue

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

Related issues

  • Discussion
  • Designs
Assignee
Assign to
8.6.3
Milestone
8.6.3
Assign milestone
Time tracking
None
Due date
None
4
Labels
bug error messages P::normal Trac import
Assign labels
  • View project labels
Reference: ghc/ghc#15944