[Haskell-cafe] Problem trying to get class Bounded to work

Jacques Carette carette at mcmaster.ca
Tue May 23 10:31:35 EDT 2006


Bulat Ziganshin wrote:

>malloc :: Storable a => IO (Ptr a)
>malloc  = doMalloc undefined
>  where
>    doMalloc       :: Storable b => b -> IO (Ptr b)
>    doMalloc dummy  = mallocBytes (sizeOf dummy)
>  
>
Is there any reason to not code this as

malloc :: Storable a => IO (Ptr a)
malloc  = mallocBytes $ sizeof undefined
?

Jacques




More information about the Haskell-Cafe mailing list