[Haskell-cafe] OCaml list sees abysmal Language Shootout results
Graham Klyne
gk at ninebynine.org
Thu Sep 30 14:06:31 EDT 2004
At 19:39 30/09/04 +0200, Tomasz Zielonka wrote:
>What I like about GHC is that I can start from simple, high-level,
>sometimes slow solutions, but if there are efficiency problems, there is
>a big chance that I can solve them without switching the language.
That's a very good point, I think. One to hang on to.
> > But I did wonder if it wouldn't be possible to also abstract out the I/O
> > element of your 'fileIterate', using instead something like:
> > streamIterate :: [b] -> (a -> b -> a) -> a -> IO a
>
>It seems to be a variant of foldl. You can eliminate IO from return
>type, or is there some reason for it?
Doh! (Why didn't I spot that?) All roads lead to Rome, or something like
that? There seems to be a recurring tension between how much to specialize
and how much to generalize.
Maybe it should be something like:
streamIterate :: (Monad m) => [b] -> (a -> b -> m a) -> a -> m a
?
Er, but that's similarly a variation of foldM, right?
Or maybe my earlier idea was closer:
streamIterate :: (Monad m) =>
(c -> m (b,c)) -> c -> (a -> b -> m a) -> a -> m a
?
Hmmm... I feel like a (intellectual) bull-in-a-china-shop here. I'm
blundering about on the trail of a delicate and elegant idea that I'm sure
others could dissect far more clearly.
What I'm trying to capture (I think) is that there's some baggage to do
with accessing the raw data and emitting the desired result that needs to
be carried along (or interleaved) with the required computation on that
data. Does this make any sense, or am I descending into farce here?
#g
------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
More information about the Haskell-Cafe
mailing list