hspec / hspec-hedgehog

A library to integrate hedgehog tests into your hspec test suite.
https://hackage.haskell.org/package/hspec-hedgehog
Other
28 stars 6 forks source link

Use `m ~ IO` to improve type inference #23

Closed ocharles closed 1 year ago

ocharles commented 1 year ago

Currently, one has to use the hedgehog identity function to force the type of the test to be PropertyT IO (). A better way to do this is to instead use an equality constraint in the instance head. This means that when we typecheck it we encounter PropertyT m () as before, but we're now able to find an instance that matches. Refining the context will the force m to be IO and everything works out fine.

ocharles commented 1 year ago

I think with this you could actually deprecate hedgehog and change the docs to not suggest pure () :: PropertyT m (), but I wanted to present just this change first.

sol commented 1 year ago

@parsonsmatt ping.

sol commented 1 year ago

Looks good! Mind updating changelog and doing a major version bump?

Done as a separate PR (#27) to not unnecessarily cause conflicts.

ocharles commented 1 year ago

Thanks both!