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
  • #13631

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

In GHCi a result is wrong when -fdefer-typed-holes is used with underscore alone

I open this ticket instead of #13579 to restate it and I closed the other.\\ In fact a result of the compiler which I think is wrong misled me.\\ Therefore I close tickets #13602 and #13557.\\ In Haskell2010 Language Report it is said that :\\

  1. underscore "_ " all by itself is a reserved identifier.\\
  2. underscore "_" is treated as a lowercase letter, and can occur wherever a lowercase letter can.\\

So _e is an identifier like __\\

GHCi gives a bad result when he computed the code below.\\

Prelude> :set -fdefer-typed-holes
Prelude> let f = map (\x -> True) [_, _]

<interactive>:2:27: warning: [-Wtyped-holes]
    * Found hole: _ :: a0
      Where: `a0' is an ambiguous type variable
    * In the expression: _
      In the second argument of `map', namely `[_, _]'
      In the expression: map (\ x -> True) [_, _]
    * Relevant bindings include
        f :: [Bool] (bound at <interactive>:2:5)

<interactive>:2:30: warning: [-Wtyped-holes]
    * Found hole: _ :: a0
      Where: `a0' is an ambiguous type variable
    * In the expression: _
      In the second argument of `map', namely `[_, _]'
      In the expression: map (\ x -> True) [_, _]
    * Relevant bindings include
        f :: [Bool] (bound at <interactive>:2:5)
Prelude> f
[True,True]

The underscore "_" is alone , all by itself and yet is recognized as an identifier, and GHCi gives a result.\\ This is the bug.

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