Automatically generate Storable instances for enums
Open
- Dominant language
- Haskell
- Stars
- 211
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.