Open poscat0x04 opened 4 years ago
Enums are CInts in memory so this should work for all types
instance Storable SomeType where sizeOf _ = 4 alignment _ = 4 peek ptr = do val <- peek (castPtr ptr) return $ toEnum $ fromEnum (val :: CInt) poke ptr v = poke (castPtr ptr) (toEnum $ fromEnum v :: CInt)
It would be nice if we add syntactic sugar for automatically generating storables instances.
Enums are CInts in memory so this should work for all types
It would be nice if we add syntactic sugar for automatically generating storables instances.