Open
Description
Since this is 21'th century, we probably can have many (most?) parentheses implied, in a way that is not dissimilar to how Haskell does implicit { ... }
blocks (which people mostly don't use for a couple of reasons that are not directly relevant here, since the tradeoffs are different, because no macros).
To be precise: the idea is to allow BOTH options (as in Haskell), since:
- We still need to allow the fully-parenthesised form to be emitted in macros, where you really really want to be specific about the parentheses.
- The long, multi-line expression cases still stand
To consider the difference of presentation -- using the example from the README:
#lang hackett
data Maybe a
nothing
just a
def x : Int
let y 3
z 7
y + z
class Show a
show : Int -> a -> String
instance forall [a] (Show a) => Show (Maybe a)
def+ show
nothing -> "nothing"
just x -> "just " <> show x
..versus:
#lang hackett
(data (Maybe a)
nothing
(just a))
(def x : Int
(let ([y 3]
[z 7])
{y + z}))
(class (Show a)
[show : {Int -> a -> String}])
(instance (forall [a] (Show a) => (Show (Maybe a)))
(def+ show
[nothing -> "nothing"]
[(just x) -> {"just " <> (show x)}]))