Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,326
    • Issues 4,326
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 390
    • Merge Requests 390
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5762

Closed
Open
Opened Jan 10, 2012 by jmg@trac-jmg

GHC gives incorrect warnings with simple applications of the view patterns extension

GHC is not able to infer exhaustivity of f1 in the following example

{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module VP where


f1, f2 :: Either Int Int -> Either Int Int

f1 (id -> Left _ ) = undefined
f1 (id -> Right _ ) = undefined

f2 (Left _ ) = undefined
f2 (Right _ ) = undefined


f (id -> _) = undefined

GHC outputs:

[1 of 1] Compiling VP               ( VP.hs, interpreted )

VP.hs:8:1:
    Warning: Pattern match(es) are non-exhaustive
             In an equation for `f1': Patterns not matched: _
Ok, modules loaded: VP.

I've tested this with GHC 7.0.4, 7.2.2, and 7.4.1-rc1 on Mac OS X.

BTW: There is neither a version entry for 7.2.2 nor for 7.4.1-rc1 in Trac.

Trac metadata
Trac field Value
Version 7.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#5762