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,322
    • Issues 4,322
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 362
    • Merge Requests 362
  • 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
  • #14008

Closed
Open
Opened Jul 22, 2017 by geekosaur@geekosaurReporter

NondecreasingIndentation is problematic when the indentation can't be decreased

Consider the following program, which was deliberately mis-indented (someone playing with an exercise with deliberate errors and being confused by the result):

module Print3Broken where

printSecond :: IO ()
printSecond = do
putStrLn greeting -- Yarrrrr out of scope

main :: IO ()
main = do
  putStrLn greeting
  printSecond
  where greeting = "Yarrrrr"

With -XNondecreasingIndentation on by default, this will parse as long as the definition of main (or any other definition) is not present after the do block. But there is no legal way to have a definition after the do because it is not possible to unindent from column 1 --- and the resulting parse error is a bit confusing and gives no hint that NondecreasingIndentation applied to the do is the cause.

I suspect NondecreasingIndentation should not be applied when it is impossible to decrease the indentation.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority low
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#14008