* Remove Member type errors
* Remove unused custom type errors
* Deprecate MemberWithError
* Remove readme notes about type errors
* Remove MemberWithError
* Simple variants of runT and bindT
* Fix accidental removal of INLINE on reinterpretH
* Rename bindTH and runTH to -Simple instead. Improve docs on these.
* Update changelog and add @since TODOs
* Small code simplifications
These are all replacements of the form
before: fmap f $ x
after: f <$> x
Minor change, but feels marginally easier to read to me.
Co-authored-by: TheMatten <matten@tuta.io>
* 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
* Add AtomicState and atomic interpreters for Output/Writer
* Fixed a word in docs, moved test functions around
* Remove runWriterIORef and runWriterTVar
* Fix strictness semantics of State and Writer
* Made tests more rigorous
* Fixed inconsistency between Writer/Output tests
* Add more tests to cover the discrepancy between run and runM
* Use strict fmap to be on the safe side
* Improve semantics of Fixpoint
* Add tests for Fixpoint, update docs
* Made the error test more rigorous
* Added references in the docs for 'runFixpoint'
* Polysemy.Internal: document change in semantics based on order of interpreters
* Polysemy.Internal: use new 'evalState' instead of mapping 'runState' in example
* Polysemy.Internal, DoctestSpec: properly support doctest
* Polysemy.Internal: small corrections
* Move Polysemy.Internal.Lift to Polysemy.Lift.Type
* Add Polysemy.Lift module and runLift interpreter
* Add a Sandy reminder
* Add explicit foralls and split type signature
* Fix import spacing, for there is no "qualified"
* Implement runIO in terms of runLift
* Rename Lift -> Embed
* Replace sendM with embed
* Add a Sandy todo for embed version
* Rename runEmbed and related runEmbedded (from IO)
* runEmbedded -> runEmbeddedInIO
* runEmbed -> runEmbedded
* Update cabal
* Added Pass to Writer, replacing Censor. Fixed semantics of listen
* Swap order of elements in the Pass tuple
* Sometimes I'm bad! Fixed compile error.
Turns out haddocks have been broken forever, but because of haskell/cabal#5977 we never noticed. This PR fixes CI so it breaks (see 6f915b6), and then fixes it by changing the GHC versions under which we're allowed to use loopbreaker. Fixes#160
This function now transforms an Output o into Output [o], which only outputs elements once the specified number of o's have been collected. The only exception is the last element which contains the rest (if any).
This PR changes the plugin so it will notice an insoluble constraint of the form Sem r a ~ Foo, and mark that r takes part in a genuine type error. The plugin will then provide a bogus evidence term for IfStuck (IndexOf r _) _ _, which prevents the AmbiguousSend error message from firing.
When emitting messages for ambiguous sends: use `IfStuck` on `r` to
determine if we can compose it. This means `r` is in one of three
states, stuck, cons or nil. We want to wrap it in parentheses iff it's
a cons.
This PR has farmed out the type error machinery out to my new package https://github.com/isovector/type-errors. It's much nicer to work with, and a big red diff!
This shuffles around the error messages so they are only connected to code generated via makeSem. This means that badly-typed interpreters will no longer set off the eager error messages!
This PR adds `runResourceBase` (which is a crap name, but naming things is hard), which interprets `Resource` without the ugly `Sem r ~> IO` parameter. It's a nice solution to #84!
The travis cache appears to be broken (probably due to the nightly stack?), but it just means CI takes like half an hour now. Since I already build on stack, I'm pretty sure it's fine --- also this will give a sanity check against accidentally breaking cabal build plans.
This improves CI times from ~30 minutes down to ~2.
This thing was a vestige of the bad old days when you had to write
*instances* of classes things in Polysemy. It was a terrible experience,
and so we don't do that anymore. As a result, the only two instances of
`Effect` were for `Union` and `Yo` --- so I just inlined them.
This PR introduces the FCF machinery that will give us more control over writing type-level functions. It defines an IfStuck a b c tyfam that will leave b around if a is stuck, otherwise it will fcf-evaluate c. Everything is polykinded so we can stack these things together to make big logic chains to emit specific variables depending on what exactly is stuck.