Hi cafe,

I'm just getting into Foreign.Storable and friends and I'm confused
about the class storable. For GHC, there are instances of storable for
all kinds of basic types (bool, int, etc) - but I can't find the
actual declaration of those instances.

I'm confused that it seems that all Storable instances operate on a
Ptr, yet none of these types allow access to an underlying Ptr. I
noticed that it's possible via Foreign.Marshal.Utils to call 'new' and
get a datatype wrapped by a Ptr, but this isn't memory managed - I'd
have to explicitly free it? Is that my only choice?

Is there a way that given just simply an Int I could obtain a Ptr from
it, and then invoke the storable functions on it? Or for that matter,
if I go and create some new data type, is there some generic
underlying thing (ghc-only or otherwise) that would let me have a Ptr
of it?

Thanks,


Tyler

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to