let pb =
[
("a", stack[n (scale "phrygian" "0 [~ 3] . 8 5 4 . 4 -1 2 0") # s "superpiano"]),
("b", stack[n (scale "phrygian" "0 [3] . 5 8 4 . 4 -3 2 0") # s "superpiano"])
]
in
d7 $ ur 4 "a b a a" pb []
while this does not :
let pb =
[
("a", stack[n (scale "phrygian" "0 [~ 3] . 8 5 4 . 4 -1 2 0") # s "superpiano"]),
("b", stack[n (scale "phrygian" "0 [3] . 5 8 4 . 4 -3 2 0") # s "superpiano"])
]
in
d7 $ ur 4 "a b a a" pb []
Problem is, in my editor (VSCode), when I do a CR, it gives me the second version.
Does haskell expect 2 spaces indent instead of 4 and that might be the cause of the problem ?
The variable names must line up, so this is an error:
let a = 3
b = 4
c = 5
A definition can go over one line, so this is ok:
let a =
3
b = 4
c = 5
However the second line must be indented further than the variable that's being defined. So this is OK:
let a =
3
b = 4
c = 5
But this isn't:
let a =
3
b = 4
c = 5
Neither is this:
let a =
3
b = 4
c = 5
So that's the problem with your second example - the [ and ] are on the same level at the thing that's being defined, and needs to be somewhere to the right of it.
Ok, thanks. I am not sure I would go to the extent to say that it makes sense but at least I know the reason now. What's the most annoying is that the IDE is not aware of that ... Does this happens in Atom too ?
It might be worth checking a haskell vscode plugin, see if that does better. If so maybe the behaviour could be brought across to the tidal plugin.
The emacs tidal plugin that I often use is based on top of the haskell one and is syntax-aware and gets the indentation mostly right