Anut-py / h-raylib

Haskell bindings for raylib
https://hackage.haskell.org/package/h-raylib
Apache License 2.0
84 stars 14 forks source link

Add lenses for record types #18

Closed glocq closed 1 year ago

glocq commented 1 year ago

The Raylib.Types modules contains many nested record types, which may need to be accessed deep inside.

This pull request implements lenses for those record types, which allow compositionally getting, setting, modifying the insides of data types.

P.S.: Note that the abstract "lenses" here obviously have nothing to do with camera lenses, even though there are camera data types in this library. For more information about lenses, see e.g. https://hackage.haskell.org/package/lens-tutorial-1.0.4/docs/Control-Lens-Tutorial.html

P.P.S.: If for some reason the dependency on the lens package is an issue, it can be removed without too much effort; see https://github.com/ekmett/lens/wiki/How-can-I-write-lenses-without-depending-on-lens%3F

Anut-py commented 1 year ago

Published in version 4.6.0.3