Wouldn't getContents from the prelude work instead of IO.getContents? This shortens a lot because now you can use ghc -e instead of runhaskell, eg.
#!/bin/sh ghc -e 'getContents>>=print.maximum.map length.lines'
We also use some other functions of the Prelude for brevity. Note that the code can't be in the same argument as -e.
In reply to Re^2: Golf: Length of longest line in a file
by ambrus
in thread Golf: Length of longest line in a file
by toolic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |