Closed kootenpv closed 6 years ago
I do get that print
in one line here:
main = do
dict <- readFile "words"
let letters = "apr"
let dictWords = Data.Set.fromList $ words dict
let perms = permutations letters
print [x | x <- perms, member x dictWords]
but that may be because I have my indent size at 2 spaces rather than 4.
For
and that the fib n could have the let x on the same line?
Do you mean
fib 0 = 0
fib 1 = 1
fib n = let x = fib n - 1
y = fib n - 2
in x + y
? We don't tend to do that because we are trying to avoid layout being dependent on the length of other symbols (in this case the indentation of y
depends on the length of the symbol fib
).
What bothers me is the dangling ]
. JT guide prompts for a newline there.
Thanks for looking into it! I thought Chris Done wrote somewhere that he stopped using indent 2 and went with 4 spaces (http://chrisdone.com/posts/hindent-5 at going forward).
While I prefer 4 spaces myself, I understand the argument for let
on a new line, though this is not the best you could do as an indenter; I understand you'd like consistency.
What I do not understand is how with these settings:
indent-size: 4
line-length: 100
force-trailing-newline: true
a line of 44 characters (the print line) could possibly be want to be spread out, while in your settings it fits on one line?
It's correct. :ok_hand:
Wanting to know if this indeed is the intended way for default indentation (don't mind the code):
It looks like that print would look better on 1 line, and that the
fib n
could have thelet x
on the same line?