bulat.ziganshin: > Hello Andrew, > > Thursday, May 31, 2007, 11:47:28 PM, you wrote: > > (Otherwise... wasn't there some library somewhere for serialising values > > in binary?) > > Binary, AltBinary (see latest HCAR), just an example using AltBinary: > > main = do > let s = encode (1.1::Float) -- s has type String > print (decode s::Float, s) >
Data.Binary is on hackage, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3 encode :: (Binary a) => a -> ByteString decode :: (Binary a) => ByteString -> a > let s = encode (1.1 :: Float) > :t s s :: Data.ByteString.Lazy.ByteString > s LPS ["\NUL\NUL\140\204\205\255\255\255\255\255\255\255\233"] > decode s :: Float 1.1 See also the older NewBinary, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/NewBinary-0.1 -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe