-
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
UX around Lift #161
UX around Lift #161
Conversation
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.
Looks great, thanks for tackling this. Left some comments inline. To answer your questions:
- I don't really care about the cabal file or not. It'll get fixed via merging one way or another.
- Please don't bump the package version
- Add a
-- TODO(sandy): @since
to the haddocks instead, which I search for before releasing new versions.
src/Polysemy/Lift.hs
Outdated
Lift (..) | ||
|
||
-- * Actions | ||
, lift |
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.
Traditionally this has been called sendM
but admittedly that is a crap name. I'm a little concerned about the overlap with MonadTrans.trans
--- but I have to say this is nice. Thoughts?
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.
If we go this way, let's remove sendM
across the codebase and reexport lift
from Polysemy
.
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.
Ah, I just did this because I was following convention (and was sleepy).
I like lift
more, because there is no non-Internal
send
for sendM
to be "based off". (like map
-> mapM
).
It has the same idea as MonadTrans.lift
so I don't think that's an issue. (?)
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.
I went ahead and did the rename, if you want to use it.
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.
Thanks for the rename! Upon looking at the changes though, I'm already confused by the name. I think overloading lift
here is only going to lead to confusion in the library. Can we come up with some other name (possibly also for the type itself?)
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.
I don't have any particularly bright ideas:
-
Name(d)
- because you're giving a "name" (syntax) to a thing that already has an interpretation (inspired by logic, where you do the same when you want to refer to an element of your universe by creating a fresh constant) -
Concrete/Unambiguous
(or some nice sounding synonym) - because you're not leaving anything "open to interpretation" (in the Syntax vs Semantics sense in which the other "native" effects are open to "interpretation")
How about we name the effect `Embed`, with action `embed`?
…On Sun, Jul 7, 2019 at 3:42 AM Georgi Lyubenov ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/Polysemy/Lift.hs
<#161 (comment)>
:
> @@ -0,0 +1,27 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module Polysemy.Lift
+ ( -- * Effect
+ Lift (..)
+
+ -- * Actions
+ , lift
I don't have any particularly bright ideas:
-
Name - because you're giving a "name" (syntax) to a thing that already
has an interpretation (inspired by logic, where you do the same when you
want to refer to an element of your universe with a constant)
-
Concrete/Unambiguous (or some nice sounding synonym) - because you're
not leaving anything "open to interpretation" (in the Syntax vs Semantics
sense in which the other "native" effects are open to "interpretation")
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#161?email_source=notifications&email_token=AACLAF5QKN5GGOGE7RD2V6LP6GM7DA5CNFSM4H6N2IU2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5VCDRY#discussion_r300853910>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACLAFYHFQ6GAT7WHX7MHLLP6GM7DANCNFSM4H6N2IUQ>
.
|
e2933ee
to
c824ce8
Compare
, Lift (..) | ||
, sendM | ||
, Embed (..) | ||
, embed | ||
|
||
-- * Lifting |
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.
Perhaps this also need a better section name (?)
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.
I think it's ok! But keen eye!
Renamed to |
{-# INLINE sendM #-} | ||
-- | Embed a monadic action @m@ in 'Sem'. | ||
-- | ||
-- TODO(sandy): @since |
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.
Not sure if this actually needs a @since
, added just in case.
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.
This thing has been around since v0, but I guess it doesn't hurt to be explicit about that! Good catch!
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.
I was thinking more does it needs a @since
for whatever version this will be in, because it's renamed.
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.
Yup, you're right! That's what I get for reviewing just before bed.
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.
This is excellent. A few last renamings and then good to go! Thanks again for this!
, Lift (..) | ||
, sendM | ||
, Embed (..) | ||
, embed | ||
|
||
-- * Lifting |
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.
I think it's ok! But keen eye!
src/Polysemy/Embed.hs
Outdated
-- run a @Embed m1@ effect by transforming it into a @Embed m2@ effect. | ||
-- | ||
-- TODO(sandy): @since | ||
runEmbed |
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.
Let's go with runEmbedded
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.
Is this the same thing that exists in Polysemy.IO
? This is admittedly a better place for it.
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.
This is the original runLift
(now renamed to runEmbed
, because the effect is Embed
) from #142, which started this pr.
It's not the same thing as Polysemy.IO.runEmbedded
.
Personally I'm fine with it being runEmbed
(in accordance with the other effects), but we need to rename the second one if this is going to be runEmbedded
.
{-# INLINE runIO #-} | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
-- | Given some @'MonadIO' m@, interpret all @'Lift' m@ actions in that monad | ||
-- | Given some @'MonadIO' m@, interpret all @'Embed' m@ actions in that monad |
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.
Let's rename this to runEmbeddedInIO
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.
Ah, I didn't see this before commenting above.
{-# INLINE sendM #-} | ||
-- | Embed a monadic action @m@ in 'Sem'. | ||
-- | ||
-- TODO(sandy): @since |
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.
This thing has been around since v0, but I guess it doesn't hurt to be explicit about that! Good catch!
* runEmbedded -> runEmbeddedInIO * runEmbed -> runEmbedded
Is this ready to go? |
Thanks for the reminder, it slipped off my radar. Let's get it merged today!
…On Thu, Jul 11, 2019 at 2:51 AM Georgi Lyubenov ***@***.***> wrote:
Is this ready to go?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#161?email_source=notifications&email_token=AACLAF5BGSJADCFZHJJFHSTP63J55A5CNFSM4H6N2IU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZVWG2A#issuecomment-510354280>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACLAFZ7DIG2FQYNAGSSAFDP63J55ANCNFSM4H6N2IUQ>
.
|
Excellent work. Thank you so much! |
Closes #142
Not sure if I should:
.cabal
runLift