4 ms·
I'd prefer main = print . sum $ [1..n] But that's almost the same.
by eru 17y ago
I'd prefer
main = print . sum $ [1..n]
But that's almost the same.
- dons 17y agoYes, you can of course use lists. I'm interested in getting the compiler to produce the best code it can, hence I use slightly different libs and flags and such.
- eru 17y agoYour version is good. I just wanted to give a small sample of idiomatic Haskell code. Colomon's post (and his subsequent enlightened reply) were good parts of the discussion, too.