This is actually pretty helpful, in that my approach to programming in a new language is "Try to do X with the new language, and if I can't, read the docs until I can." That is, I try to actually DO something, and gather incidental knowledge along the way.<p>This is a really good post on how to do something useful with Haskell (plus it has IO, which is nice). One of the nice things about this approach is that the incidental knowledge can be useful, e.g. I didn't know about the "-e" flag to GHC.
Looks like the tail implementation is O(N) in the size of the file. Real tools aren't (for large N anyway), and as this is a basically iterative algorithm (guess at a suffix size, read, count, adjust) it seems like it might have been more instructive here to do it right instead of doing it pretty.
Shouldn't they be using Data.ByteString instead of the standard Haskell string?<p>Otherwise any newbie running this code will come back crying: "it's slower than my simple python implementation" (not to mention the standard GNU tools).