Skip to content

Parser gets confused with lets containing implicit params and other things

Summary

The parser gets confused when attempting to bind implicit params and regular bindings in the same let block.

Steps to reproduce

The following program doesn't compile:

{-# LANGUAGE ImplicitParams #-}

main = do
  let ?foo = 5
      bar = 10
  pure ()

with error

    Unexpected do block in function application:
        do let ?foo = 5
    You could write it with parentheses
    Or perhaps you meant to enable BlockArguments?
  |
3 | main = do
  |       

However, putting bar in its own let fixes the problem:

{-# LANGUAGE ImplicitParams #-}

main = do
  let ?foo = 5
  let bar = 10
  pure ()

👌

Expected behavior

Both programs should be equivalent.

Environment

  • GHC version used: 8.6.5
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information