Galley polysemy (5/5) - Final cleanup#1917
Conversation
6d3e5e4 to
0fa15c7
Compare
ff6b0f5 to
1202a5e
Compare
This is useful in order to handle federation errors when making multiple concurrent requests.
Also remove usage of `Galley0` in Galley.API.Query.
Also remove Galley0 completely.
This is to extract the ZUser header as a value of type `Local UserId`. The domain is extracted from the servant context.
1202a5e to
d4d0027
Compare
|
I built this PR with It's still spitting out core warnings after the five minutes I spent filtering out those results. |
|
Doing some formatting, the compile-time cost centers are these: these numbers are coercion sizes, each of which needs to be typechecked, outputted into core, and traversed for each optimization. In particular, you're running into the problems described in this blog post. The vast majority of the issues are coming from the call to |
|
As a followup, I ran |
|
Here's the analogous big-coercion from compare to which is two orders of magnitude larger. There are two differences as far as I can see between the two --- |
|
None of this is to say that the polysemy proofs aren't huge (see polysemy-research/polysemy#427) --- but after writing a quick unsafe proof that optimizes away, they are not the issue. |
mdimjasevic
left a comment
There was a problem hiding this comment.
This is great! I left a comment on the Now effect vs. Input UTCTime.
| data Now m a where | ||
| GetTime :: Now m UTCTime |
There was a problem hiding this comment.
How come you introduced this effect? A lot of places use Input UTCTime instead of this effect. Are they any different than the getTime action of this effect?
This PR is about replacing the Galley monad with a bare Sem. All direct uses of
IOhave been hidden under effects (almost, see below):TinyLogeffect in polysemy-wire-zoo.Input UTCTimeeffect.TeamStore.Some functions still access options directly, and therefore make use of an
Input Optseffect. This could be improved later by adding the specific option getters needed to a related effect.The local domain is provided by a
Input (Local ())effect. However, I've tried using this effect sparingly, and instead pass around a local value explicitly when possible. In fact, as part of this PR, there is a new Servant combinatorZAuthLocalUserthat turns theZUserheader into aLocal UserIdargument. When wai-routes is faded out completely, we will be able to remove the global interpreter forInput (Local ())entirely.There is one remaining
Final IOeffect, used to stream csv team data. This is harder to hide under an effect, because it would correspond to a higher order action whose argument has one more effect than the base, and it's not clear how to interpret such a thing.Checklist
changelog.d.