-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Admittedly I don't know very much about haskell, so I apologize if the solution is obvious, but I can't seem to figure out how to read from an array which has a variable length.
The best I could come up with is this (for reading the memoryTypes from the "vkGetPhysicalDeviceMemoryProperties" function)
memTypes <- case memTypeIndex of
0 -> Just <$> readFieldArray @"memoryTypes" @0 memPropPtr
1 -> Just <$> readFieldArray @"memoryTypes" @1 memPropPtr
2 -> Just <$> readFieldArray @"memoryTypes" @2 memPropPtr
3 -> Just <$> readFieldArray @"memoryTypes" @3 memPropPtr
4 -> Just <$> readFieldArray @"memoryTypes" @4 memPropPtr
5 -> Just <$> readFieldArray @"memoryTypes" @5 memPropPtr
6 -> Just <$> readFieldArray @"memoryTypes" @6 memPropPtr
7 -> Just <$> readFieldArray @"memoryTypes" @7 memPropPtr
...
I can't find any example or code anywhere that uses readFieldArray with a variable length, so with my limited knowledge of Haskell, I'm not sure if there is a better way.
Would it be possible to describe how this is done in some documentation somewhere or in an example?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels