lexi-lambda / freer-simple

A friendly effect system for Haskell
https://hackage.haskell.org/package/freer-simple
BSD 3-Clause "New" or "Revised" License
227 stars 19 forks source link

Generalize makeEffect to work with more complicated GADTs #17

Closed andremarianiello closed 5 years ago

andremarianiello commented 5 years ago

closes https://github.com/lexi-lambda/freer-simple/issues/16

Instead of descending down into the types in the constructor looking for free variables (I have a branch that does this) I think it is cleaner to simply reuse the preexisting contexts from the GADT constructor. Thus, if the variable quantification and contexts were correct in the constructor, they should still be correct for the generator function (I think).

I bumped the version, but I don't know if I bumped the right number.

lexi-lambda commented 5 years ago

Can you add a test case? Otherwise, this looks good, thanks.

andremarianiello commented 5 years ago

I added a complex GADT, and I run makeEffect on it inside the test file, but it is not part of a test case per se. Do you have any idea how to create a Testy test case for a TH splice like this? Or is simply compiling the test file with the splice in it good enough?

lexi-lambda commented 5 years ago

Yes, that simple regression test is fine. Thank you for this! Merged as cd7b4c62fd69dcac9841fe9dec07d4086b6a7f07.

andremarianiello commented 5 years ago

Thanks for the quick release!