Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,868
    • Issues 4,868
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #18559
Closed
Open
Created Aug 10, 2020 by lennart@augustsson.net@trac-lennart

Let statements don't work with ApplicativeDo

Summary

Let statements don't work with ApplicativeDo. Bug or feature?

Steps to reproduce

Compile this snippet and see the compiler complain.

{-# LANGUAGE ApplicativeDo #-}
module Bug where

foo :: Applicative f => f Int
foo = undefined

bar :: Applicative f => f Int
bar = do
  x <- foo
  let y = x + 1
  pure y

Expected behavior

I would expect let bound variables to be allowed if they are not used in any RHSs of <- bindings.

The example above can trivially bee rewritten to (which works)

bar :: Applicative f => f Int
bar = do
  x <- foo
  pure $ let y = x + 1 in y

Environment

  • GHC version used:

The Glorious Glasgow Haskell Compilation System, version 8.10.1

Edited Aug 10, 2020 by lennart@augustsson.net
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking