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 372
    • Merge Requests 372
  • 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
  • #16874

Closed
Open
Opened Jun 26, 2019 by Andreas Abel@abel

Silly vertical printing of long argument lists

Summary

GHC's pretty printer does not cope well with long argument lists.

Long argument lists do exist in practice, e.g, for records: https://github.com/agda/agda/blob/83a48d27010d2c292cc42100081a24f8df573688/src/full/Agda/TypeChecking/Serialise/Instances/Errors.hs#L192-L198

Steps to reproduce

type A = Int
data D = D A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A

test :: D -> D
test (D a b c d e f g h i j k l m n o p q r s t u v w x y z aa bb cc dd ee ff gg hh ii jj kk ll mm nn)
  = D a b c d e f g h i j k l m n o p q r s t u v w x y z aa bb cc dd ee ff gg hh ii jj kk ll mm nn

The compiler reports:


ManyConstructorArgs.hs:5:7: error:
    • The constructor ‘D’ should have 41 arguments, but has been given 40
    • In the pattern:
        D a
          b
          c
          d
          e
          f
          g
          h
          i
          j
          k
          l
          m
          n
          o
          p
          q
          r
          s
          t
          u
          v
          w
          x
          y
          z
          aa
          bb
          cc
          dd
          ee
          ff
          gg
          hh
          ii
          jj
          kk
          ll
          mm
          nn
      In an equation for ‘test’:
          test
            (D a
               b
               c
               d
               e
               f
               g
               h
               i
               j
               k
               l
               m
               n
               o
               p
               q
               r
               s
               t
               u
               v
               w
               x
               y
               z
               aa
               bb
               cc
               dd
               ee
               ff
               gg
               hh
               ii
               jj
               kk
               ll
               mm
               nn)
            = D a
                b
                c
                d
                e
                f
                g
                h
                i
                j
                k
                l
                m
                n
                o
                p
                q
                r
                s
                t
                u
                v
                w
                x
                y
                z
                aa
                bb
                cc
                dd
                ee
                ff
                gg
                hh
                ii
                jj
                kk
                ll
                mm
                nn
  |
5 | test (D a b c d e f g h i j k l m n o p q r s t u v w x y z aa bb cc dd ee ff gg hh ii jj kk ll mm nn)
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expected behavior

Print argument list in horizontal mode and wrap it somewhere.

Environment

  • GHC version used: 8.6.4
Assignee
Assign to
8.10.1
Milestone
8.10.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#16874