I would like to create a new GType corresponding to a simple haskell datatype such as
data MyType = MkA | MkB Int | MkC Int
I thought the way to do this was to write a Storable instance and use boxedTypeRegisterStatic, but the type of that function makes no sense to me: it expects two functions, one copy function of type type BoxedCopyFunc = IO (Ptr ()) and one free function of type typed BoxedFreeFunc = IO (), but neither of those functions get the input pointer. There are type synonyms type BoxedCopyFunc_WithClosures = Ptr () -> IO (Ptr ()) and type BoxedFreeFunc_WithClosures = Ptr () -> IO () which pass the input pointer to be copied or freed, but those two type synonyms don't really seem to be used anywhere.
I don't want to create a type that is a descendant of GObject as that is very heavy when all I want is a little bit of data that I can put in a GValue and pass along in e.g. a drag-and-drop operation.
I would like to create a new
GTypecorresponding to a simple haskell datatype such asI thought the way to do this was to write a
Storableinstance and useboxedTypeRegisterStatic, but the type of that function makes no sense to me: it expects two functions, one copy function of typetype BoxedCopyFunc = IO (Ptr ())and one free function of typetyped BoxedFreeFunc = IO (), but neither of those functions get the input pointer. There are type synonymstype BoxedCopyFunc_WithClosures = Ptr () -> IO (Ptr ())andtype BoxedFreeFunc_WithClosures = Ptr () -> IO ()which pass the input pointer to be copied or freed, but those two type synonyms don't really seem to be used anywhere.I don't want to create a type that is a descendant of
GObjectas that is very heavy when all I want is a little bit of data that I can put in aGValueand pass along in e.g. a drag-and-drop operation.