From be1ad6c645fbe855fec7b96288168c1eda3153f6 Mon Sep 17 00:00:00 2001 From: Marshall Abrams Date: Sun, 19 Oct 2025 19:52:55 -0500 Subject: [PATCH] Added item "Semicolons can't replace newlines" Not sure what the best location for this is. It's minor, so I put it near the end. It's about the language, so I put it before the item concerning documentation comments. (I tried to use semicolons for newlines and found it didn't work, and went looking for confirmation that there was no way to do this. Was told in discord that it's not an option. --- language/Differences-from-Haskell.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/language/Differences-from-Haskell.md b/language/Differences-from-Haskell.md index b4cc320..4f8be31 100644 --- a/language/Differences-from-Haskell.md +++ b/language/Differences-from-Haskell.md @@ -364,6 +364,20 @@ For `error`, you can use `Effect.Exception.Unsafe.unsafeThrow`, in the `purescri Although note that these might have different behaviour to the Haskell versions due to PureScript's strictness. +## Semicolons can't replace newlines + +In Haskell, an expression that normally uses multiple lines can be written in one line by substituting semicolons for newlines. For example, in Haskell, +```purescript +do + x <- Just 2 + pure (1 + x) +``` +can be written as +```purescript +do ; x <- Just 2 ; pure 2 +``` +This isn't allowed in Purescript; the `do` expression has to be written on multiple lines. + ## Documentation comments When writing documentation, the pipe character `|` must appear at the start of every comment line, not just the first. See [the documentation for doc-comments](Syntax.md#comments) for more details.