aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_drafts/peculiar_indentation.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--_drafts/peculiar_indentation.md7
1 files changed, 4 insertions, 3 deletions
diff --git a/_drafts/peculiar_indentation.md b/_drafts/peculiar_indentation.md
index e8378e1..9c6930d 100644
--- a/_drafts/peculiar_indentation.md
+++ b/_drafts/peculiar_indentation.md
@@ -8,7 +8,7 @@ category: Haskell
custom_css:
- syntax.css
---
-A Haskell indentation pitfall I've fallen into.
+I've fallen into a Haskell indentation pitfall.
I think it must be common, so I'm describing it here.
The problem is that indentation rules in `do` blocks are not intuitive to me.
@@ -74,8 +74,7 @@ foo4 = do
The truth is, the rules for desugaring `do` blocks are surprisingly simple and
literal.
-First, GHC inserts semicolons according to the rules described here:
-https://en.wikibooks.org/wiki/Haskell/Indentation#Explicit_characters_in_place_of_indentation.
+GHC inserts semicolons according to the rules [found in the Wikibook].
So it inserts semicolons between the `alloca`s on the same level, so `foo4`
becomes:
@@ -93,6 +92,8 @@ foo4 = do
}
```
+[found in the Wikibook]: https://en.wikibooks.org/wiki/Haskell/Indentation#Explicit_characters_in_place_of_indentation
+
The semicolons after `->` are clearly invalid Haskell syntax, hence the error.
P.S. To compile the functions above, you need to include them in a module and