raw data access

Johan Henriksson johen at student.chalmers.se
Mon May 1 18:57:17 EDT 2006


this is just an idea, that came out from some discussion on #haskell.

if one would want to use an external fast library for storing data
(using FFI), one would need some sort of marshalling. this is inconvenient
as to my knowledge one would have to add new code for each type, correct
me if I'm wrong. one solution would be to add (just conceptually)

toBinary :: a -> [Int]  -- pack data as a string of bytes
fromBinary :: [Int] -> a -- unpack
binarySize :: a -> Maybe Int
-- number of bytes for this type or Nothing if not fixed

the packing would be compiler dependent since it is not of interest
to read the content, just to get an easy way of marshalling arbitrary types.

this might be low priority for now, just giving my input while still
remembering it.

/Johan Henriksson



More information about the Haskell-prime mailing list