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

Jacques Carette carette at mcmaster.ca
Wed May 31 10:13:36 EDT 2006

You would need to define a type class
(Binary a) => EncodedPtr a b
where the 'a' is as you have it currently, and the b would be an 
enumerated type which tracks the memory representation.

I agree they are different concepts - that is why an EncodedPtr would 
require 2 type parameters.  Of course, this class would define 
encode/decode functions, but without the need for the name encoding (and 
additional safety).


Bulat Ziganshin wrote:
> Hello Jacques,
> Wednesday, May 31, 2006, 5:33:39 PM, you wrote:
>>> decodePtrBitAlignedLE :: (Binary a, Integral size) =>  Ptr x -> size -> IO a
>> 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,
> can you please write code you suggested? i'm not sure that type "a"
> should be encoded only to area pointed by "Ptr a" - binary encoding of
> value and it's memory representation are different concepts, although
> they are similar at the look

More information about the Haskell-Cafe mailing list