[Haskell-cafe] A very edgy language

Andrew Coppin andrewcoppin at btinternet.com
Sun Jul 8 13:27:44 EDT 2007

Gwern Branwen wrote:
> Out of curiosity, why does ByteString wreck the cleanness of your BWT? It seems to me that if you're doing
>  bwt :: String -> Whatever
>  bwt arg = ...(time and space intensive ByteString operations).... $ ByteString.pack arg
> then your code is only modestly less clean.

It's more that currently I have

  bwt :: (Ord x) => [x] -> [x]

and I'm going to have to change that to

  bwt :: ByteString -> ByteString

Then I'll have to change all the list functions to ByteString functions. 
And then - the hardest part - I'm going to have to edit my entire 
program framework to make it do ByteString I/O instead of [Char], and 
pipe it all the way through to the BWT function. And then I'll have to 
go edit all the algorithms that *don't* use ByteStrings to fix them...

The alternative is to do

  bwt = ByteString.unpack $ ... $ ByteString.pack

I have no idea how efficient or not that would be...

More information about the Haskell-Cafe mailing list