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

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed May 31 11:09:40 EDT 2006


Hello Jacques,

Wednesday, May 31, 2006, 5:33:39 PM, you wrote:

>> encodePtr             :: (Binary a, Integral size) =>  a -> IO (ForeignPtr x, size)
>> encodePtrLE           :: (Binary a, Integral size) =>  a -> IO (ForeignPtr x, size)
>> encodePtrBitAligned   :: (Binary a, Integral size) =>  a -> IO (ForeignPtr x, size)
>> encodePtrBitAlignedLE :: (Binary a, Integral size) =>  a -> IO (ForeignPtr x, size)
>>
> 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?

i misunderatood you when i wrote previous message. now that i can say:

you are right. but on practice this means more text typing and
coercion. especially when we go to ForeignPtrs. moreover, in most
cases, imho, data encoded by 'encodePtr*', will go to the FFI
libraries, so we can't use typechecking anyway

i'm not against your idea, you absolutely right that this will be more
Haskell way, but can this be implemented without additional
complications for library users?


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list