-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No more strategy #239
No more strategy #239
Conversation
I see how this works. Clever! It's a shame we need to keep A thing I recently realized is that it is possible to strengthen This also allows you to define
And use |
Wait, this introduces ambiguity issues in previously-valid uses of |
One way to get rid of the ambiguity issues is to require getInitialStateT :: forall m n r f. Sem (Tactics m f n ': r) (f ())
getInitialStateT = send @(Tactics m _ n) GetInitialState I think that's a much better idea, seeing how |
Yeah. I mean it's not great, but then again, neither is the current situation. Way more people are complaining about how complicated tactics/strategy is, than the number complaining about having to use a plugin. Since our performance is already tied to enabling the plugin, it doesn't seem like much of a burden --- though I could definitely be persuaded on this front. |
Does that work for the `Strategic` cases?
…On Sat, Oct 5, 2019 at 11:15 AM KingoftheHomeless ***@***.***> wrote:
One way to get rid of the ambiguity issues is to require Tactics to be
the first element of the effect row, rather than using a Member
constraint, like this:
getInitialStateT :: forall m n r f. Sem (Tactics m f n ': r) (f ())
getInitialStateT = send @(Tactics m _ n) GetInitialState
I think that's a much better idea, seeing how Tactics is always be the
first element of the effect row when it's used.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#239?email_source=notifications&email_token=AACLAF2BLVP25QY5S2WZ26DQNBLK7A5CNFSM4I5SFHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEANOEAY#issuecomment-538632707>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACLAFYE4A63GQXZUZPG7N3QNBLK7ANCNFSM4I5SFHCA>
.
--
I'm currently travelling the world, sleeping on people's couches and doing
full-time collaboration on Haskell projects. If this seems interesting to
you, please consider signing up as a host!
https://isovector.github.io/erdos/
|
Yup. |
Nice. Thanks! I'll get this cleaned up then. |
I'll make it part of my pull request; it's almost ready |
I beat you! |
dammit You win this one, but I'll show you yet! |
One thing I'm curious about is |
|
Are we sure about removing |
Let's just make it 2.0 /shrug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Alright then.
* Strengthen Strategy, fix tactics ambiguity issues * Generalize pureT * Fix compilation errors * Revert unintended change to stack.yaml
=> Sem '[Strategy m f n] a | ||
runStrategy :: forall m f n a | ||
. (Functor f, Monad m) | ||
=> Sem '[Tactics m f n, Embed m, Final m] a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KingoftheHomeless, the suggestion is to replace runM
with this thing, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, runM
shouldn't have anything to do with tactics: the suggestion was to have runM
like this:
runM :: Monad m => Sem '[Embed m, Final m] a -> m a
runM = usingSem $ \u -> case decomp u of
Right (Weaving (Embed m) s _ ex _) ->
(ex . (<$ s)) <$> m
Left g -> case extract g of
Weaving (WithWeavingToFinal wav) s wv ex ins ->
ex <$> wav s (runM . wv) ins
If we do, then runStrategy
can be implemented like this:
runStrategy sem = \s wv ins -> runM $ interpret
(\case
GetInitialState -> pure s
HoistInterpretation f -> pure $ \fa -> wv (f <$> fa)
GetInspector -> pure (Inspector ins)
) sem
@TheMatten and I are hanging out this weekend and cleaning up things. This PR gets rid of
Strategy
as a unique concept, though doesn't clean up the*S
functions.