Perplexed by how this code is processed by Haskell’s Layout facility

This is a known and documented deviation of GHC from the Haskell standard in default or Haskell 98 mode.

GHC has a language extension called NondecreasingIndentation that can be used to trigger this behaviour. If enabled, a do keyword introduces a new block even if the next token starts at the same indentation level as the surrounding block.

If you don’t want this, say either -XNoNondecreasingIndentation or -XHaskell2010 (or use language pragmas accordingly).

You can view a pretty-printed version of the code that GHC parsed by passing the -ddump-parsed flag to GHC. This will only partially remove layout (it does so for do-blocks, but e.g. not for let), but might still provide clues.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)