Skip to content

Merge produces let ... in ... inside do block #9

@sgraf812

Description

@sgraf812

Here's a repro.zip that, when merged with hsreduce merge massiv-example produces an AllInOne.hs with a syntax error:

      go !i
        | i Prelude.< k4
        = do let
               r = f (unsafeLinearIndex_DataMassivCoreCommon arr i)
                     Prelude.||
                       f (unsafeLinearIndex_DataMassivCoreCommon arr (i Prelude.+ 1))
                         Prelude.||
                           f (unsafeLinearIndex_DataMassivCoreCommon arr (i Prelude.+ 2))
                             Prelude.||
                               f (unsafeLinearIndex_DataMassivCoreCommon arr (i Prelude.+ 3))
             in
               if r then
                   Control.Scheduler.cancelBatchWith batch Prelude.True
               else
                   do done <- Control.Scheduler.hasBatchFinished batch
                      if done then Prelude.pure Prelude.True else go (i Prelude.+ 4)

Compiling the file complains about the in. I think let ... in ... might be illegal in that situation because it produces an expression, but we need a statement in that context. Maybe this is a weakness in the Haskell grammar (after all, how to tell whether we want a statment let vs. expression let?), not sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions