[Haskell-cafe] Re: [Haskell] installing streams library

Jacques Carette carette at mcmaster.ca
Wed May 31 11:40:50 EDT 2006


I have no problems with marshalling/unmarshalling (and even with the 
implicit casting going on).  What I dislike is having a bunch of 
functions which are "the same" but with different names, where the 
difference boils down to enumerated types that end up being encoded in 
the function name.  Regardless of type safety.

Jacques

Tim Newsham wrote:
>> Am I the only one who finds this encoding-of-types in the _name_ of a 
>> function quite distateful?  There is no type safety being enforced 
>> here, no ensuring one will not be encoding a Ptr one way and decoding 
>> it another.  Why not use Haskell's type system to help you there?
>
> When marshalling data you often don't want any type safety.  You often 
> want to explicitely linearize data from one type and then unlinearize 
> it into another type.  The net result is that of casting.  In fact, 
> you can write a marshalling library with an interface based entirely 
> on this concept:
>
> http://www.lava.net/~newsham/x/Pkts5.lhs
>
> The interface is, in essense, a glorified casting mechanism.  To 
> marshall data you convert it to an array of bytes and to unmarshall 
> data you unconvert it.
>
>> Jacques
>
> Tim Newsham
> http://www.lava.net/~newsham/


More information about the Haskell-Cafe mailing list