jonascarpay / apecs

a fast, extensible, type driven Haskell ECS framework for games
391 stars 43 forks source link

cfold over cache operates on same entity multiple times #38

Closed cpennington closed 5 years ago

cpennington commented 5 years ago

As far as I can tell, there are cases when a cfold over a Cache k (Map SomeComponent) will sometimes call the combining function on the same entity multiple times. If this is intended, it's surprising and should perhaps be documented.

jonascarpay commented 5 years ago

Thanks for reporting, that's definitely not intended behavior. I can't seem to reproduce this however, can you provide an example?

cpennington commented 5 years ago

The repo I observed it in was private, so it's hard to give you a quick repro case. I was using something like flip cfold [] $ \acc (c, e :: Entity) -> (c, e) : acc, and got a list that had the same (c, e) pair at the beginning and the end.

jonascarpay commented 5 years ago

This should be fixed in 8.1.0, please let me know if you still run into this