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,323
    • Issues 4,323
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 367
    • Merge Requests 367
  • 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
  • #13602

Closed
Open
Opened Apr 22, 2017 by vanto@trac-vanto

Pattern syntax in expression context must be clarified

To simonpj\\ see tickets #13557 and #13579\\

Typed Holes does not exist if we compile with GHC version 7.6.3. Instead of "error found holes" it indicates "pattern syntax in expression context: _".\\ I then understood that to improve Typed Holes it was first necessary to remove the ambiguity of the error in GHC 7.6.3 about pattern syntax in expression.\\

let f = [True | x <- [_, _]] raise the error pattern syntax in expression context: _\\ But as Typed Holes, this error has no sense here.\\

let f' = [_ | x <- [1,2]]will give a result like "__" And this calculation also makes sense if one refers to the rule of inference, as the function f

  1. \\

\\ The compiler should not impose its way.\\ The programmer must be the master of his code. Here the rule of inference seems flouted.\\

Good sense or reason is argued to be the same in all people, yet differences in opinion are not due to differences in intelligence but to the fact that we use different approaches and consider different things.\\

Here you will find some ideas:\\ Instead of "underscore _" as "pattern syntax" we could use a new type called "indefinite" in expression.\\ Any calculation with "indefinite" will result in "indefinite".\\ In another calculation, the "indefinite" type could have a type defined according to a directive applied to the compiler.\\ example:\\ indefinite :: Int\\ f = [1,2,3,indefinite,5,6]\\

I took a look at ticket #9497 and find it very interesting.\\

Trac metadata
Trac field Value
Version 8.0.2
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#13602