TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Simple Unix tools in Haskell

39 pointsby gurramanabout 14 years ago

4 comments

dfcabout 14 years ago
For all those times when you don't have coreutils installed but you have ghc6/ghc7 installed.
评论 #2491545 未加载
gabebwabout 14 years ago
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.
评论 #2491835 未加载
ajrossabout 14 years ago
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.
评论 #2491704 未加载
nimrodyabout 14 years ago
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).
评论 #2492115 未加载
评论 #2492254 未加载