
hey Levent,
I can't claim to have thought about it that deeply, but naively, it seems
like a qualified export approach might not play nice with certain
approaches to seperate compilation (not that GHC does it that much),
because the names qualifications wouldn't match possible import modules, Or
at least the qualified names in scope wouldn't match what you see from the
import lines, and thus you'd have a harder time supporting good quality
error messages? (i could be totally wrong)
its definitely an interesting idea, and i certainly dont have clarity on
what the implications would be
On Thu, Feb 21, 2019 at 1:42 PM Levent Erkok
I think Carter outlined really good reasons for not including `e`; but it's hard not to sympathize with the request. I often felt shy of adding similar definitions in my libraries for fear that they would pollute the name space. But their absence is rather annoying. The classic solution is to put it in a library, internal module etc, and make a new class if necessary; which is often overkill and misses the simplicity sought in the first place.
I often wonder if Haskell can have a "qualified export" feature for these cases. Just like we can "import qualified," why not "export qualified" some names, which means if you simply import the module the name will still be available qualified. (You can of course always import qualified.)
I haven't thought too much about the implications of this, but it might be an easy solution to this problem. Would love to hear thoughts on this; is there any language that has this feature? How costly would it be to add it to GHC?
On Thu, Feb 21, 2019 at 10:32 AM chessai .
wrote: asymmetry in presence, not use.
When I was first learning Haskell, the absence of e along with the presence of pi in Floating confused me. It is not a disservice to users to note this asymmetry in documentation and why it is not there.
On Thu, Feb 21, 2019, 1:22 PM Carter Schonwald < carter.schonwald@gmail.com> wrote:
i dont see it as an assymetry, theres a lot of very simple volume / area / probability /geometry calculations where pi comes up, i dont know any for e that aren't just exp. can you share some?
On Wed, Feb 20, 2019 at 10:50 PM chessai .
wrote: Yeah, I think it probably shouldn't be added to the typeclass then.
The asymmetry should probably be mentioned in the report though.
On Wed, Feb 20, 2019, 9:22 PM Carter Schonwald < carter.schonwald@gmail.com> wrote:
either way, we're not gonna add e :)
On Wed, Feb 20, 2019 at 8:30 AM Yitzchak Gale
wrote: Lennart's question "Is it really worth it?" is the most important one. And no, probably it isn't.
But Chessai is correct that this is a weird asymmetry in the Floating class. My own experience is that I user neither e nor pi very much, but neither one more than the other.
Branch cuts of inverse trig functions are not relevant. The report doesn't explicitly state this, but it's clear that these functions are expected to return the standard ranges of values as in other programming languages. You can be quite certain that acos (-1) is pi in Haskell. And in fact, we have (at least on my computer)
Prelude> acos (-1) == pi True
So there isn't any more or less reason to have e than pi as a separate class member.
On Sun, Feb 17, 2019 at 10:15 PM Lennart Augustsson
wrote: > > Is it really worth it? How frequent are uses of e, except used like exp? On the other hand, pi has more frequent standalone use cases. > Also, e has a simple definition (exp 1), whereas pi is somewhat more involved. > > The logp1 and expm1 functions where added for good numerical reasons. The same would not be true for e. > > On Sat, Feb 16, 2019 at 21:14 chessai . wrote: >> >> We have the 'pi' constant in the floating typeclass and some trigonometric functions, as well as things like exp/log/expm1/log1p. >> >> Why not provide an 'e' constant? >> >> A default implementation could just be 'exp 1'. >> _______________________________________________ >> Libraries mailing list >> Libraries@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > _______________________________________________ > Libraries mailing list > Libraries@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries