[Haskell-beginners] Using Traversal as a kind of pointer

Daniel Trstenjak daniel.trstenjak at gmail.com
Mon Aug 18 11:30:05 UTC 2014


Hi Elise,

I'm not quite sure if I completely understood your use case, but if
you only want to modify the lifeforms that are colliding with the player,
then you could have something like:

   world & liveforms . filtered (collidingWith player) %~ \liveform -> ...

with

   liveforms :: Lens' World [Lifeform]

   collidingWith :: Player -> Lifeform -> Bool


I would consider this as a quite nice solution.


Greetings,
Daniel


More information about the Beginners mailing list