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,268
    • Issues 4,268
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 408
    • Merge Requests 408
  • 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
  • #4905

Closed
Open
Opened Jan 19, 2011 by batterseapower@trac-batterseapower

New flag to disable warning on incomplete pattern matches in lambdas

The distinction between -fwarn-simple-patterns and -fwarn-incomplete-patterns was eliminated in September 2010 (http://darcs.haskell.org/cgi-bin/darcsweb.cgi?r=ghc;a=darcs_commitdiff;h=20100922133934-1287e-6ae16bafe86ad0941286982f3bf593377f081384.gz).

I really like -fwarn-incomplete-patterns: it is a great bug finding tool. However, I find that whenever I decompose a value using a lambda-bound pattern I never want a warning. After all, lambdas-patterns cannot choose between several different possibilities, so by using the lambda syntax I'm fairly explicitly signalling that I only expect to get that one possibility at runtime.

One situation where this gets really annoying is when decomposing a value into some holes and a way to rebuild the value around new values for those holes. Consider:

decompose :: Term -> ([Term], [Term] -> Term)
decompose e = case e of
  Var x              -> ([], \[] -> Var x)
  Value (Lambda x e) -> ([e], \[e'] -> Value (Lambda x e')))
  ...

I "know" that the lambda should never fail to match, but with -fwarn-incomplete-patterns I now get tons of spurious warnings about the apparently incomplete patterns. This noise is drowning out genuine situations where I may have unintentionally missed a possibility, such as in "case" expressions.

In short, I would really like a flag to turn off incomplete pattern match warnings for lambdas (and probably pattern bindings as well, though I don't use those so often). If this flag is on, anywhere where I (the programmer) have used pattern matching syntax that cannot dispatch over multiple possibilities should ""not"" elicit incomplete pattern match warnings.

Trac metadata
Trac field Value
Version 7.0.1
Type FeatureRequest
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#4905