[Haskell-cafe] needsaname :: ([a] -> Maybe (b, [a])) -> (b -> [a]) -> [a] -> [a]

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri Jul 6 23:16:29 EDT 2007

> I've written it to run over lists, but it would not be difficult to
> make it run over ByteStrings instead, and exploit the 'no-copying'
> effect on the bits of the stream which were not modified, which would
> be very handy for programs processing large bytestrings.

I wonder if there's a efficient way of writting generic code that runs
over String or over ByteString? Or at least with Lazy and Strict

I mean, I can write something like

double :: Num a => a -> a
double x = x * 2

and, e.g. if I want speed on Doubles (and am using GHC)

{-# SPECIALIZE double :: Double -> Double #-}

but AFAIK there isn't a way of doing so with all the string types?

And, if we're really lacking these mechanisms, is it because of a lack
of formulation or because it isn't possible to generalise String

Thanks! =)


More information about the Haskell-Cafe mailing list