aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_drafts/peculiar_indentation.md
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2018-02-18 04:43:25 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2018-02-18 04:43:25 +0300
commitee150f2bf39ad1c4c05776891d3d1ad1ac8bd9a2 (patch)
tree8c7019a27411980ed97e57cb2dfc77f9a9321ed6 /_drafts/peculiar_indentation.md
parentimport "Peculiar Haskell indentation" form a gist (diff)
downloadjekyll-theme-ee150f2bf39ad1c4c05776891d3d1ad1ac8bd9a2.tar.gz
jekyll-theme-ee150f2bf39ad1c4c05776891d3d1ad1ac8bd9a2.zip
peculiar: make it a proper post
Diffstat (limited to '_drafts/peculiar_indentation.md')
-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