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

Udo Stenzel u.stenzel at web.de
Tue May 23 12:33:44 EDT 2006


Jacques Carette wrote:
> 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
> ?

There is.  Don't you think there's a reason why doMalloc above has an
explicit type signature?  What would happen if you deleted it?


Udo.
-- 
"You, sir, are nothing but a pathetically lame salesdroid!
I fart in your general direction!"
        -- Randseed on #Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060523/625c0b77/attachment.bin


More information about the Haskell-Cafe mailing list