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!