Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 296 297 298 299 300 301 302 303 304 305 306 .. 5022
502,152 events total
2020-09-29 16:29:43 <dolio> Seems like that would be one of the most useful extensions.
2020-09-29 16:29:45 <merijn> dolio: Not sure if it's in yet
2020-09-29 16:29:53 geekosaur joins (42d52102@66.213.33.2)
2020-09-29 16:29:54 <merijn> dolio: But the GHC proposal was approved
2020-09-29 16:30:18 <dolio> Then you can declare record types and generate overloaded lenses instead of monomorphic accessors.
2020-09-29 16:30:21 <merijn> dolio: https://github.com/ghc-proposals/ghc-proposals/pull/160
2020-09-29 16:30:24 <monochrom> I'm biased, I'll just point you to my favourite: my thesis supervisor's textbook :) http://www.cs.toronto.edu/~hehner/aPToP/
2020-09-29 16:30:25 kritzefitz joins (~kritzefit@212.86.56.80)
2020-09-29 16:30:34 × kritzefitz quits (~kritzefit@212.86.56.80) (Client Quit)
2020-09-29 16:30:36 <ski> it would be useful, yes
2020-09-29 16:30:47 <dolio> Which gives you a much better record system than a bunch of ad-hoc nonsense.
2020-09-29 16:30:52 tzh joins (~tzh@2601:448:c500:5300::82b3)
2020-09-29 16:30:54 <merijn> dolio: Looks like it'll be 9.2: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4017
2020-09-29 16:31:14 elcaro joins (~anonymous@45.32.191.75)
2020-09-29 16:31:18 <dolio> Ah, okay.
2020-09-29 16:31:29 <zincy_> monochrom: Thanks, I learned to prove things by studying Analysis so looking for the next step really that will tie in with programming :)
2020-09-29 16:31:34 <dolio> And you no longer have to name your field _foo.
2020-09-29 16:31:47 thir joins (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de)
2020-09-29 16:33:11 <Guest18> Does anybody know how is Maybe implemented?
2020-09-29 16:33:28 <dolio> To be honest, I blame a bit of the record stuff on the 'rigorous typeclasses' culture that has developed.
2020-09-29 16:33:37 <maerwald> @src Maybe
2020-09-29 16:33:37 <lambdabot> data Maybe a = Nothing | Just a
2020-09-29 16:33:39 machinedgod joins (~machinedg@45.78.189.122)
2020-09-29 16:33:51 <Guest18> @src Nothing
2020-09-29 16:33:52 <lambdabot> Source not found. My brain just exploded
2020-09-29 16:33:58 <maerwald> That's a constructor
2020-09-29 16:34:19 <[exa]> Guest18: Nothing is defined by that definition of Maybe
2020-09-29 16:34:31 <geekosaur> as is Just
2020-09-29 16:34:34 <maerwald> I'm wondering which university started this haskell course :p
2020-09-29 16:34:53 <dolio> Type classes are obviously the correct way to overload records, but any suggestion for using it would get hammered by the "there are no LAWS" crowd. So instead people need to invent a less thought out version of type classes that you're allowed to use how you want.
2020-09-29 16:35:06 <Guest18> [exa] so they don't have implementations? They are just symbols of sorts?
2020-09-29 16:35:06 × voyons_osti quits (~dan@107-190-41-58.cpe.teksavvy.com) (Read error: Connection reset by peer)
2020-09-29 16:35:27 <[exa]> Guest18: yeah, perfectly arbitrary "labels". Just like False and True
2020-09-29 16:35:39 voyons_osti joins (~dan@107-190-41-58.cpe.teksavvy.com)
2020-09-29 16:35:46 <merijn> Guest18: Define "implementations"
2020-09-29 16:35:55 <merijn> Guest18: That *is* the implementation
2020-09-29 16:35:58 <monochrom> dolio, the good news is you have convinced me. :) Next time I teach my course, I'll be relaxing on traits of good type classes.
2020-09-29 16:36:08 <ski> Guest18 : they don't have implementations in Haskell, beyond that `data' type definition
2020-09-29 16:36:25 <Guest18> that's a bit confusing, i might say
2020-09-29 16:36:27 × thir quits (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de) (Ping timeout: 240 seconds)
2020-09-29 16:36:39 <ski> whyso ?
2020-09-29 16:36:58 × elcaro quits (~anonymous@45.32.191.75) (Ping timeout: 256 seconds)
2020-09-29 16:37:21 <ski> you know (or will know) how to work with them, practically. why do you care about "what they really are" ?
2020-09-29 16:37:23 elcaro joins (~anonymous@45.32.191.75)
2020-09-29 16:37:34 jgt joins (~jgt@233724.soborka.net)
2020-09-29 16:38:04 <monochrom> But even my previous version was open-ended. I had "useful expectations", this included social expectations, so overloaded field name would be fine. Also, I only intend a spectrum, not a boolean.
2020-09-29 16:38:22 Turmfalke joins (~user@unaffiliated/siracusa)
2020-09-29 16:38:27 <Guest18> Regarding what [exa] said about True and False: if they are just arbitrary labels, why can i put a guard, a condition after and it automatically knows it should execute that only if the condition == True
2020-09-29 16:38:45 <Guest18> ski: Just curios, Nothing else ;)
2020-09-29 16:38:45 <maerwald> I'd favor a version of the haskell language without type classes :p ...just wondering how we'd implement functors etc
2020-09-29 16:38:46 <ski> you know you can construct `Maybe' values, with `Nothing', and with `Just'. and you know you can detect which way a `Maybe' value was constructed, by using pattern-matching, on the `Nothing' and `Just' cases (getting the "contents" as well, in the latter case)
2020-09-29 16:38:51 <ski> what more do you need ?
2020-09-29 16:38:56 <[exa]> Guest18: because the "label" for True is shared between `guard` and your program, and they know it's the same thing
2020-09-29 16:39:00 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2020-09-29 16:39:20 × bitmagie quits (~Thunderbi@200116b80673370090ed3453f880395e.dip.versatel-1u1.de) (Quit: bitmagie)
2020-09-29 16:40:08 <maerwald> Guest18: there are also pattern guards: | (Just m) <- foo = bar
2020-09-29 16:40:08 <ski> Guest18 : well, guard syntax (and `if', and list comprehensions) knows about `Bool' in particular
2020-09-29 16:40:18 <geekosaur> booleans are partially wired into the compiler because of guards, among other things (but this is just an optimization). Maybe isn't, because there's no equivalent usage inside the compiler for it
2020-09-29 16:40:38 <monochrom> Lately I've been writing a GHC.Generics tutorial, and also realize that it is very difficult to uphold "has laws" for the homebrew type classes you have to define in order to have a place for your generic algorithm to live in.
2020-09-29 16:40:38 <maerwald> lets drown them in information :p
2020-09-29 16:40:42 klardotsh joins (~klardotsh@c-71-231-242-112.hsd1.wa.comcast.net)
2020-09-29 16:40:46 <ski> you could define your own version of `if' (as an ordinary function), though. `if ... then ... else ...' is just a handy syntactic sugar
2020-09-29 16:41:16 <ski> maerwald : it's an old established tradition :)
2020-09-29 16:41:23 <Guest18> ski: just curiosity to see how complicated it is on the inside. I mean, I always assume whatever i get from the standard library is going to have some weird implementation that I can't understand. Wanted to see what the deal was with Maybe
2020-09-29 16:41:53 <maerwald> Those are reasonable expectations from a standard library
2020-09-29 16:42:25 <Guest18> i get it now, i experimented with Maybe for a bit already and get how to use it, and now wanted to see how it works
2020-09-29 16:43:01 <ski> what's the difference between "how to use it" and "how it works" ?
2020-09-29 16:43:12 puffnfresh_ joins (~puffnfres@45.76.124.5)
2020-09-29 16:43:18 <maerwald> > join (+) 4 -- hey Guest18, look at this :p
2020-09-29 16:43:20 <lambdabot> 8
2020-09-29 16:43:32 <maerwald> :t join
2020-09-29 16:43:33 <lambdabot> Monad m => m (m a) -> m a
2020-09-29 16:43:58 <geekosaur> there's nothing to know, really. either it's Nothing or it's Just some value. there are some typeclass instances that make it more convenient to use in various cases, but those aren't wired in to the compiler either
2020-09-29 16:44:16 × puffnfre- quits (~puffnfres@45.76.124.5) (Ping timeout: 256 seconds)
2020-09-29 16:44:18 <Guest18> ski: i can drive a car, or 'use' it, but i don't know all the internals and how it functions
2020-09-29 16:44:38 × elcaro quits (~anonymous@45.32.191.75) (Ping timeout: 260 seconds)
2020-09-29 16:44:40 × jgt quits (~jgt@233724.soborka.net) (Ping timeout: 246 seconds)
2020-09-29 16:44:47 elcaro joins (~anonymous@45.32.191.75)
2020-09-29 16:44:51 <ski> it could "work" then in different ways, depending on which implementation of the language you're using
2020-09-29 16:45:01 <Guest18> maerwald: I haven't gotten into Monads, that's uncharted territory to me
2020-09-29 16:45:02 <monochrom> There are English native speakers, I think even the majority, who use "how does it work" to mean, seriously, how to use.
2020-09-29 16:45:05 <[exa]> Guest18: on the inside there's a very rough reminiscent of a tagged union (something like enum with extra struct members, if you like C)
2020-09-29 16:45:06 <ski> (but then we're not talking about Haskell, but implementations of Haskell)
2020-09-29 16:45:38 <[exa]> but yeah that depends a lot on the actual implementation.
2020-09-29 16:45:40 <dolio> monochrom: Yeah, the important thing is to judge the value in context, and not over-generalize some rigid rule set. Like, mathematical structures are a good way to figure out nice type classes. But they're not the only way.
2020-09-29 16:45:47 <maerwald> monochrom: isn't that a rather american thing?
2020-09-29 16:46:20 <maerwald> where "work" is overloaded to all sorts of meanings
2020-09-29 16:46:22 <Guest18> ski: yeah, you are right here. I should have asked: what's a probable implementation of Maybe?
2020-09-29 16:46:37 <monochrom> I don't know. But I'm afraid more people speak American English than British English. I deplore it, but I admit defeat. And it's spelled colour, not color!
2020-09-29 16:46:38 <ski> Guest18 : what [exa] said
2020-09-29 16:46:42 × nbloomf quits (~nbloomf@2600:1700:83e0:1f40:b183:d428:bf80:8a35) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-09-29 16:46:46 <Guest18> [exa]: I see, thank you so much
2020-09-29 16:46:53 <dolio> And with generics that's just a completely different application, basically.
2020-09-29 16:47:01 <ski> Guest18 : have you seen C ?
2020-09-29 16:47:27 <Guest18> what lambdabot said does remind me of an enum of sorts
2020-09-29 16:47:51 <Guest18> ski: if i have seen it? what do you mean?
2020-09-29 16:48:08 thir joins (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de)
2020-09-29 16:48:46 <Guest18> you mean if i've ever seen C code? Sure i have
2020-09-29 16:48:51 <Guest18> Quite a lot
2020-09-29 16:49:05 <[exa]> you might like the ghc RTS then. :]

All times are in UTC.