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

Closed
Open
Opened Jul 20, 2015 by kolmodin@dtek.chalmers.se@trac-kolmodin

GHC warning shows technical summary of AST instead of the user's code

Have a look at this code and the warning it generates;

-- T10662.hs
main :: IO ()
main = do
  return $ let a = "hello" in a
  return ()

We compile it with ghc --make -Wall T10662.hs

[1 of 1] Compiling Main             ( T10662.hs, T10662.o )

T10662.hs:3:3: Warning:
    A do-notation statement discarded a result of type ‘[Char]’
    Suppress this warning by saying
      ‘_ <- ($)
              return
              let
                AbsBinds [] []
                  {Exports: [a <= a
                               <>]
                   Exported types: a :: [Char]
                                   [LclId, Str=DmdType]
                   Binds: a = "hello"}
              in a’
    or by using the flag -fno-warn-unused-do-bind
Linking T10662 ...
 $

Naturally GHC warns me that I'm throwing away the result, and should write like this;

main :: IO ()
main = do
  _ <- return $ let a = "hello" in a
  return ()

I find it confusing that the warning mentions AbsBinds, exports and types. I'd expect a snippet of my code in the warning.

It doesn't look like this is a (recent) regression. The same happens GHC 7.8.4 and 7.10.1.

Edited Mar 10, 2019 by kolmodin@dtek.chalmers.se
Assignee
Assign to
8.0.1
Milestone
8.0.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#10662