Original issue: tweag/ormolu#299
PR: tweag/ormolu#457
Original example:
main = do
action before
if condition then
action 1
else
action 2
action after
A more complex flow showing off single layout rule for if, case, let, and where ("drop and indent"):
example = do
let
consistency =
if theKey then
"look how nicely it all fits together"
else
undefined
case scrutinee of
() ->
if () == () then
let
sure = "it is"
in
putStrLn sure
else do
case noWay of
Just _in ->
error "no, not really"
Nothing ->
pure ()
butHonestly $
if () /= () then
what "else?"
else
what "?"
where
noWay =
if True then
Nothing
else
noWay
Ormolu says:
example = do
let consistency =
if theKey
then "drop `then`, but not `of`"
else undefined
case scrutinee of
() ->
if () == ()
then
let sure = "have one more space before in"
in putStrLn sure
else do
case noWay of
Just _in ->
error "no, not really"
Nothing ->
pure ()
butHonestly $
if () /= ()
then why "drop `then`, but not `of`"
else why "?"
where
noWay =
if True
then Nothing
else noWay
Indeed, it doesn't look as good for 4 spaces. It's mostly for us, 2-spacers.
Original issue: tweag/ormolu#299
PR: tweag/ormolu#457
Original example:
A more complex flow showing off single layout rule for
if,case,let, andwhere("drop and indent"):Ormolu says:
Indeed, it doesn't look as good for 4 spaces. It's mostly for us, 2-spacers.