Wednesday 15 February 2012

ghci - Haskell: how to add a patch? -



ghci - Haskell: how to add a patch? -

i'm in io chapter of larn haskell , noticed discrepancy in how bytestrings displayed me vs. screenshots in book (see below example). unless folks have other suggestions, seems solution (at least, per this post) install this patch.

it's pretty basic question but...how go installing type of patch?

am of course of study open other suggestions re: how have ghci display right bytestring format.

my setup/system:

ghci 7.6.3 (installed via haskell platform) xubuntu 14 (virtualbox)

how bytestrings displayed in book. (note: can assume author loaded script containing next import qualified data.bytestring.lazy b.)

ghci> b.cons 85 $ b.pack [80,81,82,84] chunk "u" (chunk "pqrt" empty)

how bytestrings displayed on computer:

prelude> import qualified data.bytestring.lazy b prelude b> b.cons 85 $ b.pack [80,81,82,84] "upqrt"

the patch you're referencing showing difference between older , newer version of bytestring, newer version uses hand-written show instance. shouldn't installing it, it's lyah needs few updates here , there (haskell development has moved pretty fast in lastly few years).

the bytestring constructors have been made private, can't utilize them directly. because of this, show instance should output string can turned bytestring, , easiest way using pack or overloadedstrings extension.

there tochunks function in data.bytestring.lazy, i'm not sure want. basically, should consider bytestring implementation private , utilize exported library functions ensure don't break anything. equivalent wanting see internals of data.map.map, wouldn't pretty work with.

haskell ghci

No comments:

Post a Comment