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,260
    • Issues 4,260
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 401
    • Merge Requests 401
  • 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
  • #9182

Closed
Open
Opened Jun 07, 2014 by dfranke@trac-dfranke

Empty case analysis for function clauses

Thanks to -XEmptyCase, the following is legal:

  module Empty where
  
  data Empty
  
  empty :: Empty -> a
  empty x = case x of { }

However, if I leave off the last line, GHC will complain that The type signature for ‘empty’ lacks an accompanying binding.

I think this program should be accepted. It isn't that I'm not giving a definition for empty; it's that I'm defining it to be a function with no accompanying equations, as could be represented in Template Haskell by

$(return [FunD (mkName "empty") []])

Currently, this too is rejected, with GHC complaining Function binding for ‘empty’ has no equations. I think this should be legal, with an empty list of clauses in a function definition being treated the same way as an empty list of matches in a case expression.

Edited Mar 09, 2019 by dfranke
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#9182