* Use cabal-doctest
- Haskell build tools run in slightly different environments (meaning different
package databases are available).
- The nixpkgs build for polysemy-plugin is failing due to a missing package
database, which causes the doctest to fail (more information here:
https://github.com/NixOS/nixpkgs/issues/71164).
- By using cabal-doctest we can expose the Haskell packages required to the
doctests no matter the build tool we're using.
* Use cabal-doctest in polysemy, build on GHC 8.8.1
- Use @googleson78 's changes to build polysemy on GHC 8.8.1, with slight
modifications. The source distribution is now found in "dist-newstyle/sdist",
so we've updated the command to point at that folder. Additionally, cabal
v2-install doesn't support installing .tar.gz files in the same way v1-install
did, so updated the command to use "cabal v1-install".
- Modified polysemy to use "cabal-doctest" and so overcome issues with the
doctest tests (see issue #258, PR #265).
The IO Resource interpreters had a bug in `BracketOnError` that would
fail to run the finalizers if the error was a Sem error (as opposed to
an IO exception.)
This PR also reworks the bracket spec so that it runs each test for
every interpreter, hopefully keeping them all in sync in the future.
Fixes#262
In interpreter mode, the plugin used to see rows like State (Identity a) ': State a ': r, with an action in State a, and then incorrectly unify that thing with the first thing in the list State (Identity a). As a result, we'd ask for Identity a ~ a, which is infinite, and things would go wrong.
Now we instead collect all of the unifications we'd like to do, and only emit the most specific one, as measured by number of type constructors in it. This will now only emit a State (Identity a) ~ State (Identity s), and then unify the state we're looking for, plus the a ~ s that solves the other state action.
But the next problem is that we can't determine IndexOf in the row above, because a is a type variable, and so IndexOf is stuck, even though we know IndexOf that_row (State a) ~ 'S 'Z. So the plugin now also solves "stuck" IndexOfs of that form.
All of this means we can now happily introduce local effects that have type variables, for effects that are already known to be present in the row. And somehow it just works! Amazing!