You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, newBuffer, newTexture, runDraws and draw all take a record value that have many fields, some are set, some or not. Now that we depend on lens, we could do something like this:
-- Old API:
-- newBuffer :: MonadIO m => BufferCreation -> m Buffer
newBuffer defaultBufferCreation { bufferSize = 123, initialData = Just some_ptr }
-- New API:
-- newBuffer2 :: MonadIO m => (BufferCreation -> BufferCreation) -> m Buffer
newBuffer2 $ (bufferSizeL .~ 123) . (initialDataL .~ Just some_ptr)
Some of the new convenience functions I wrote for Graphics.Caramia.Buffer already use this. The default value is supplied by the function itself; user changes fields they want. And lens is excellent at this kind of use.
TODO: Add lenses for all the specification records and export them. Add new API functions.
The text was updated successfully, but these errors were encountered:
For example,
newBuffer
,newTexture
,runDraws
anddraw
all take a record value that have many fields, some are set, some or not. Now that we depend onlens
, we could do something like this:Some of the new convenience functions I wrote for
Graphics.Caramia.Buffer
already use this. The default value is supplied by the function itself; user changes fields they want. Andlens
is excellent at this kind of use.TODO: Add lenses for all the specification records and export them. Add new API functions.
The text was updated successfully, but these errors were encountered: