Instances for Storable

Nivia Q. niviaquental at yahoo.com.br
Thu Jun 24 13:39:42 EDT 2004


Hi GHC users,
I've been  trying to create a instance for Maybe type in the Storable class. I need to override the peek and poke methods, but I'm having some difficulties. I was intended  to do something like this:
 
instance Storable t =>Storable (Maybe t) where
 peek ptr = maybePeek peek ptr
 poke ptr valMaybe = do
                                   ptr<-maybeNew (new) valMaybe
                                   return()
 
Obviously, there is a type error on the definition of peek, because  the type of prt  is (Ptr a), not (Ptr (Maybe a)) . I don't know how to fix it and,  at the same time, keep using instanciation.
I would be grateful for suggestions,
Regards,
 


_________________________________________________
Nivia Cruz Quental
Graduação em Eng. Computação - UPE
Técnica em Telecomunicações - CEFET-PE - Brasil






---------------------------------
Crie seu Yahoo! Mail, agora com 100MB de espaço, anti-spam e antivírus grátis!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/glasgow-haskell-users/attachments/20040624/6317146d/attachment.htm


More information about the Glasgow-haskell-users mailing list