[Haskell-cafe] Binary serialization, was Re: Abstraction leak
Dave Bayer
bayer at cpw.math.columbia.edu
Thu Jul 5 12:41:23 EDT 2007
On Jul 5, 2007, at 8:00 AM, Paul Moore wrote:
> It probably depends on your perspective. I've found lots of tasks that
> would be a simple library call in Python, but which require me to
> write the code myself in Haskell. Examples:
>
> * Calculate the MD5 checksum of a file
How's this, only one line is specific to your problem:
> import System.Process
> import IO
>
> doShell :: String -> IO String
> doShell cmd = do
> (_,out,_,_) <- runInteractiveCommand cmd
> hGetContents out
>
> main :: IO ()
> main = do
> md5 <- doShell "md5 -q md5.hs"
> putStrLn md5
It's not like you'll be kicked out of the tree house for leaving the
Haskell world to get things done. For example, ghostscript and pdf2ps
are well-supported open source tools for converting PS to PDF, that
can be called from most languages. What's the deal with everyone
rewriting PDF handling in their pet language, when it's so much
easier to generate Postscript? I'd call that Balkanization; if I were
managing a software group, I'd never let that happen.
The true problem isn't adequate libraries in each language, it's
interoperability so great open-source tools can get written once and
then be supported by a cast of thousands.
There are people who claim with a straight face that they migrated to
OS X primarily to use TextMate
http://www.textmate.com
which is a GUI editor getting Emacs-like buzz, making Emacs seem by
comparison like your grandfather's razor. It's as much a text-based
operating system as an editor, and the whole thing is glued together
with hundreds of snippets of code one can hack, written in every
scripting language imaginable. Polyglots feel right at home...
More information about the Haskell-Cafe
mailing list