Commit Graph

268 Commits

Author SHA1 Message Date
Sandy Maguire
0a1ce2b837 Add hspec-discover to package build-tools
Fixes #111
2019-06-15 20:12:18 -04:00
Sandy Maguire
82f86add29
Custom type error testing (#113)
This PR adds doctests allowing us to write tests for the custom type errors. Having this stuff reified in the test suite means we can iterate on the implementations and give much better QA.
2019-06-15 20:04:11 -04:00
Sandy Maguire
b5d086b859 Release polysemy-plugin 0.2.1.0 2019-06-14 11:38:47 -04:00
Sandy Maguire
e90c745d7a
Allow bidirectional typechecking in the plugin (#105)
* Allow bidirectional typechecking in the plugin

The plugin used to choke on this:

```haskell
flipShouldBe 11 . sum . fst . run . runFoldMapOutput id $ do
  output [1]
  output $ replicate 2 5
```

because it would fail to unify `Output (t Int)` (the polymorphic
`Traversable` variable in `sum`) with `Output [Int]`.

In this case, there are no given constraints, so the plugin is
attempting to solve a `Member (Output (t Int)) '[Output [Int]]`. We
reuse the codepath for unifying wanted/givens, pretending like the
`Output (t Int)` is a given.[^1]

[^1]: Pretending it's a wanted breaks something else that I don't
remember right now. This code is brittle :(

So now we have a "wanted" `Output [Int]`, and a "given" `Output (t
Int)`. In general, this thing isn't OK to solve. Consider a real
example:

```haskell
foo :: Member (Output (t Int)) r => Sem r ()
foo = output [5]
```

This is a type error, because the polymorphism goes the wrong way. We
have no guarantees that `t` is supposed to be `[]`.

But in our original example, this isn't a problem, because our `t` isn't
actually in given position. It's just an artifact of reusing the code!
`mkWanted` now takes a new parameter for whether or not it's OK to allow
the givens to be polymorphic.

Such a thing necessitates a change though. We never want to unify
a polymorphic *effect* in given position. Doing so will break Haskell's
regular type inference that determines what the effect row should be,
based on the order in which the interpreters are run.
2019-06-14 11:28:14 -04:00
Sandy Maguire
18e16f68db Release polysemy-plugin 0.2.0.3 2019-06-13 15:39:57 -04:00
Sandy Maguire
fc88a961ad
Ensure wanted constraints are emitted only once. (#102)
* Ensure wanted constraints are emitted only once.

This is a fix for the "solveSimpleWanteds: too many iterations" problem
that people are running into. In these cases, the plugin is being asked
to solve the same `Member` constraint several times, and generating
a new wanted each time. In doing so, GHC thinks that work was done, so
it will ask the plugin to run again next time. This process diverges,
and produces the error.

Fixes #79
2019-06-13 14:39:49 -04:00
Sandy Maguire
416530b149
Use tySynInstDCompat for future compatibility with TH (#101)
Fixes #99
2019-06-12 11:45:26 -04:00
Sandy Maguire
e960ce1877 Release polysemy 0.4.0.0 2019-06-12 09:40:08 -04:00
Sandy Maguire
b7f2922c3a
Better Resource bracketing (#87) 2019-06-12 09:36:08 -04:00
Sandy Maguire
4ca49cba2b Ensure polysemy-plugin's package.yaml is correct 2019-06-12 09:32:09 -04:00
Silvan Mosberger
979413a5e1 Update polysemy-plugin version bound (#100)
The test suite is made for 0.3 and doesn't compile with earlier versions
due to Yo now taking another argument since
https://github.com/isovector/polysemy/pull/71
2019-06-11 18:47:57 -04:00
Sandy Maguire
1813b53750 Release polysemy-plugin 0.2.0.2 2019-06-09 00:27:18 -04:00
Sandy Maguire
eff97914f7 Release polysemy 0.3.0.1 2019-06-09 00:22:50 -04:00
Sandy Maguire
66be47036d
Perform recursive unification attempts in the plugin (#96) 2019-06-09 00:20:23 -04:00
Sandy Maguire
ca0c68e1c3 Fix benchmark
Fixes #92
2019-06-08 23:15:37 -04:00
Sandy Maguire
c57f79bce4 Simplify Combinators and Internal modules 2019-06-07 14:17:43 -04:00
Sandy Maguire
f5dcbe3c98
Fixes #54 (#85) 2019-06-05 09:44:34 -04:00
Sandy Maguire
0f41b3fddf Test for #47 2019-06-05 03:44:31 -04:00
Sandy Maguire
c937132caa Release polysemy 0.3.0.0 2019-06-01 23:43:41 -04:00
Sandy Maguire
cd074a4bd4
Move Random to polysemy-zoo (#78)
* Move Random to zoo

* Changelog
2019-06-01 18:42:12 -04:00
Sandy Maguire
e41b73bb55 Unnecessary import 2019-06-01 16:30:33 -04:00
TheMatten
974b8f11de Update smart constructors generation with tests and support for operators (#77) 2019-06-01 14:46:14 -04:00
Sandy Maguire
4350b675b8 Stupid typo 2019-05-31 00:13:45 -04:00
Sandy Maguire
601cbe8630 Release polysemy 0.2.2.0 2019-05-31 00:10:52 -04:00
Sandy Maguire
63b1f4257f
GetInspectorT (#71)
* Evacuation wip

* Two other uses of weave

* Evacuator -> Inspector

* Inspector test
2019-05-31 00:06:46 -04:00
Sandy Maguire
7d256e2b8f WORLDS BEST LOGO (#72) 2019-05-30 03:11:35 -04:00
Sandy Maguire
45322a1ee5 Logo 2019-05-30 02:53:40 -04:00
Sandy Maguire
37e48dfe16 Update changelog 2019-05-29 14:24:44 -04:00
TheMatten
b41e650f00 Rewrite 'Polysemy.Internal.TH.Effect' in terms of 'th-abstraction' (#67) 2019-05-29 14:15:46 -04:00
Sandy Maguire
8dfafb9b75 Release plugin version 0.2.0.1 2019-05-28 15:52:53 -04:00
Sandy Maguire
7cc2f8c567 Fix #68 2019-05-28 15:48:03 -04:00
Sandy Maguire
b6f16e762b Add runErrorAsAnother 2019-05-27 01:39:14 -04:00
Sandy Maguire
9a4d878d1f Add since pragmas for the new instances 2019-05-27 01:39:05 -04:00
Sandy Maguire
ad42c75fcf Release polysemy 0.2.1.0 2019-05-27 01:16:14 -04:00
Sandy Maguire
aefb1deef0 Add plugin badge to the README 2019-05-23 19:24:57 -04:00
Sandy Maguire
09ca7b9233 Release polysemy-plugin-0.2.0.0 2019-05-23 17:06:24 -04:00
Sandy Maguire
feacd2a001
Fix the plugin (#62) 2019-05-23 17:05:32 -04:00
Georgi Lyubenov
882cd80abf Fix typo: uunderneath -> underneath (#60) 2019-05-23 12:50:38 -04:00
Jack Henahan
049f74aa99 Remove erroneous Prelude import (#59) 2019-05-23 12:50:15 -04:00
Sandy Maguire
f2de66ac52 Release version 0.2.0.0 2019-05-23 03:53:07 -04:00
Sandy Maguire
a20994abab
Fix broken higher order effects (#58)
* Fix a serious bug in interpretH and friends

* Spec to prove reader works now
2019-05-23 03:49:26 -04:00
Sandy Maguire
f84dc25775 Add warning to .@, and lower its precedence.
Fixes #42
2019-05-22 12:58:53 -04:00
Sandy Maguire
ff222d826a
Automatically inline recursive calls in the plugin (#52)
* Inline recursive calls + bonus passes for inlining

* Broken inspection test

* Bug in inspection testing

* Deprecate inlineRecursiveCalls

* Move inlineRecursiveCalls into the deprecated section
2019-05-20 02:15:18 -04:00
Sandy Maguire
71001dc049 Split out fundep part of plugin 2019-05-19 23:02:08 -04:00
Christopher Sasarak
c97aa118c1 Mention polysemy-plugin in ambiguous effect error message. (#49) 2019-05-18 23:49:32 -04:00
Sandy Maguire
76d5f1953e
Release 0.1.2.1 (#51) 2019-05-18 11:42:14 -04:00
Sandy Maguire
17f127319d
Merge pull request #50 from isovector/fix-ci
Fix CI
2019-05-18 08:53:45 -04:00
Sandy Maguire
4fee31ab68 Fix CI 2019-05-18 08:40:32 -04:00
Sandy Maguire
b5ea9ae0fd guard todos on GHC 8.0.10 2019-05-16 16:16:08 -04:00
Sandy Maguire
2cfd3692f2 Let plugin know when to improve performance 2019-05-16 15:26:18 -04:00