[Haskell-cafe] Data.Binary stack overflow with Data.Sequence String

Gwern Branwen gwern0 at gmail.com
Fri Mar 6 20:19:40 EST 2009

On Thu, Mar 5, 2009 at 6:51 AM, Neil Mitchell <ndmitchell at gmail.com> wrote:
> Hi Gwern,
> I get String/Data.Binary issues too. My suggestion would be to change
> your strings to ByteString's, serisalise, and then do the reverse
> conversion when reading. Interestingly, a String and a ByteString have
> identical Data.Binary reps, but in my experiments converting,
> including the cost of BS.unpack, makes the reading substantially
> cheaper.
> Thanks
> Neil

Ah, thanks for the advice. Switching to (strict) ByteString seems to
resolve the stack overflow. (And thank goodness too, I need my

I hadn't realized it was the String that was messing things up and
being lazy. Very annoying! (The String code was cleaner - fewer


More information about the Haskell-Cafe mailing list