You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to check my development Type-preserving compilation via dependently typed syntax (SPLS March 2023) with the current standard library, I get a failure for a trivial reason:
The module IO.Primitive doesn't export the following:
return
when scope checking the declaration
open import IO.Primitive public using (return; _>>=_)
In this state, I see no easy way to make my development work with both std-lib 1.7.1/2 and 2.0.
An easy fix would be to restore return to this module with the alias return = pure which could maybe be coming with a deprecation warning.
(Though in my view there is no consensus in the FP community that return is a bad word and pure the good word. Esp. when the return statement is the last of my function, it makes perfectly sense to say return result rather than pure result).
@gallais Please have a look at #2125 which adds the backwards-compatibility with v1.7 that I need for an IO-monadic Agda development (the one mentioned in the OP).
add the alias pure = return to v1.7.2 IO.Primitive (and, if necessary, any hiding (pure) directives in client modules where this might be a problem)
adding 'stub' versions of Effect.Functor and Effect.Applicative (and Effect.Monad?) to v1.7.2 which provide the Raw* functionality, but otherwise publicly re-export from Category.*; how much of the Category.* tree do you actually require for your development?
import in a both-versions-compatible way (in your talk-related client module(s)) open import IO.Primitive public using (_>>=_) renaming (pure to return)
Does that work?
TL;DR: patch/retrofit v1.7.2 (and if necessary, a minor version bump) so that it is forwards compatible with v2.0, not the other way round.
The discussion on #2129 seems to be asking for a v1.7.3 (or back-patching v1.7.2). Suggest we lift this out as a separate issue, and collect a number of issues which might be solved by such a thing (such as these two, but what else?), together with some discussion/agreement about what (minimal) patches might be necessary? But I do worry that this would be opening a door...
Given how widely return is used, maybe it should be case_return_of_ whose name should be changed? Thought I don't have any particular suggestions. Just throwing it out there @gallais ?
Yeah of course but as you said, there are no alternative name proposals (#356).
And on the other hand, should we pollute the namespace with an alias for pure just because
Haskell does so? Should we add fmap as an alias for _<$>_ because people may reach for
it out of habit?
Yeah of course but as you said, there are no alternative name proposals (#356).
case_yield_of_ would use a synonym of "return".
In other PLs (except maybe Coq), neither return nor yield is used for the return type, but always for the return value.
Also case_return:_of_ is thinkable with the : emphasizing a return type.
On Zulip, @jamesmckinna suggested case_returning_of_. I happen to also like your 'thinkable' suggestion. (i.e. either returning or return: would feel like an improvement). I don't feel that yield is much of an improvement for the very reason you mention: it still feels value-level rather than type-level.
I'm pinching myself a little here... is it really the case that the only use(s) of case... return... of... in the library are in Function.Base (and README.Case which itself only uses one instance!)? It seems as though all other uses are of the derived form case... of..., in which case the renaming/deprecation return$\mapsto$returning could/would be immediate...?
I'll let others who want return pick up that particular slack. But I would argue to retain #356 ie. pure as well as the factorisation of Monad via Applicative...
Activity
gallais commentedon Oct 6, 2023
The issue is that
returnclashes withcase_return_of_.Fix #2124: `IO.Primitive.return` (alias for `pure`) for backwards compat
andreasabel commentedon Oct 6, 2023
@gallais Please have a look at #2125 which adds the backwards-compatibility with v1.7 that I need for an IO-monadic Agda development (the one mentioned in the OP).
jamesmckinna commentedon Oct 6, 2023
[UPDATED] Suggest instead:
pure = returnto v1.7.2IO.Primitive(and, if necessary, anyhiding (pure)directives in client modules where this might be a problem)Effect.FunctorandEffect.Applicative(andEffect.Monad?) to v1.7.2 which provide theRaw*functionality, but otherwise publicly re-export fromCategory.*; how much of theCategory.*tree do you actually require for your development?open import IO.Primitive public using (_>>=_) renaming (pure to return)Does that work?
TL;DR: patch/retrofit v1.7.2 (and if necessary, a minor version bump) so that it is forwards compatible with v2.0, not the other way round.
jamesmckinna commentedon Oct 10, 2023
The discussion on #2129 seems to be asking for a v1.7.3 (or back-patching v1.7.2). Suggest we lift this out as a separate issue, and collect a number of issues which might be solved by such a thing (such as these two, but what else?), together with some discussion/agreement about what (minimal) patches might be necessary? But I do worry that this would be opening a door...
MatthewDaggitt commentedon Oct 11, 2023
Given how widely
returnis used, maybe it should becase_return_of_whose name should be changed? Thought I don't have any particular suggestions. Just throwing it out there @gallais ?gallais commentedon Oct 11, 2023
Yeah of course but as you said, there are no alternative name proposals (#356).
And on the other hand, should we pollute the namespace with an alias for
purejust becauseHaskell does so? Should we add
fmapas an alias for_<$>_because people may reach forit out of habit?
andreasabel commentedon Oct 12, 2023
case_yield_of_would use a synonym of "return".In other PLs (except maybe Coq), neither
returnnoryieldis used for the return type, but always for the return value.Also
case_return:_of_is thinkable with the:emphasizing a return type.JacquesCarette commentedon Oct 13, 2023
On Zulip, @jamesmckinna suggested
case_returning_of_. I happen to also like your 'thinkable' suggestion. (i.e. eitherreturningorreturn:would feel like an improvement). I don't feel thatyieldis much of an improvement for the very reason you mention: it still feels value-level rather than type-level.Taneb commentedon Oct 13, 2023
I also like
case_returning_of, I feel it reads fluentlyjamesmckinna commentedon Oct 16, 2023
I'm pinching myself a little here... is it really the case that the only use(s) of$\mapsto$
case... return... of...in the library are inFunction.Base(andREADME.Casewhich itself only uses one instance!)? It seems as though all other uses are of the derived formcase... of..., in which case the renaming/deprecationreturnreturningcould/would be immediate...?MatthewDaggitt commentedon Oct 16, 2023
Yup, that was what I found as well.
tackles agda#2124 as regards `case_return_of_`
jamesmckinna commentedon Oct 16, 2023
Alright, I'll bite... #2157
tackles #2124 as regards `case_return_of_` (#2157)
MatthewDaggitt commentedon Oct 16, 2023
Which means I guess that we can now allow
returnto make a return. I do think we'll get a lot of complaints if we don't keep it.jamesmckinna commentedon Oct 17, 2023
I'll let others who want
returnpick up that particular slack. But I would argue to retain #356 ie.pureas well as the factorisation ofMonadviaApplicative...jamesmckinna commentedon Oct 17, 2023
Now that #2157 has been merged in, there will need to be an eventual update to the section on pattern lambdas in the
readthedocsto reflect this...MatthewDaggitt commentedon Oct 18, 2023
Nice spot!
tackles agda#2124 as regards `case_return_of_` (agda#2157)
'No infinite descent' for (`Acc`essible elements of) `WellFounded` re…
tackles #2124 as regards `case_return_of_` (#2157)
'No infinite descent' for (`Acc`essible elements of) `WellFounded` re…
Merge v2.1.1 into `master` (#2473)