Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-26 05:23:01 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds)
2020-11-26 05:24:47 × vg quits (~vg@139.59.59.230) (Quit: vg)
2020-11-26 05:24:56 × adm_ quits (~adm@43.229.88.197) (Ping timeout: 240 seconds)
2020-11-26 05:25:00 vg joins (~vg@139.59.59.230)
2020-11-26 05:25:23 × vg quits (~vg@139.59.59.230) (Remote host closed the connection)
2020-11-26 05:25:24 × berberman_ quits (~berberman@unaffiliated/berberman) (Ping timeout: 240 seconds)
2020-11-26 05:25:39 vg joins (~vg@139.59.59.230)
2020-11-26 05:25:52 berberman joins (~berberman@unaffiliated/berberman)
2020-11-26 05:26:35 <jle`> incertia: maybe not Has, but As :)
2020-11-26 05:26:37 × Tario quits (~Tario@201.192.165.173) (Ping timeout: 256 seconds)
2020-11-26 05:29:09 crestfallen joins (~jvw@192-184-135-144.fiber.dynamic.sonic.net)
2020-11-26 05:31:34 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:31:35 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:31:49 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:31:50 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:32:04 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:32:05 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:32:19 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:32:20 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:32:30 <crestfallen> hello is there a beginners channel or should I go to #haskell-overflow ? there is something fundamental I don't understand between do notation and bind notation; in the "divvy" example at the bottom of this paste: http://ix.io/2Fvz
2020-11-26 05:32:35 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:33:16 Guest10117 joins (~vollenwei@4e69b241.skybroadband.com)
2020-11-26 05:33:32 <incertia> i mocked up a sample library basically by inlining the lens definitions, is there anything i can simplify? https://gist.github.com/incertia/f1386a06b7c2a008f0bbbd6d1d74a0b9
2020-11-26 05:33:57 adm_ joins (~adm@43.229.88.197)
2020-11-26 05:34:27 <MarcelineVQ> divvy is missing a read compared to divv
2020-11-26 05:35:14 <crestfallen> thanks MarcelineVQ I've been trying put a second read in for a very long time. what's the trick?
2020-11-26 05:35:37 <MarcelineVQ> do the same thing you did for the first read
2020-11-26 05:37:55 <MarcelineVQ> x <- read became read >>= \x -> ... so you just do that again
2020-11-26 05:38:49 <crestfallen> o ne moment please
2020-11-26 05:40:16 × Guest10117 quits (~vollenwei@4e69b241.skybroadband.com) (Ping timeout: 272 seconds)
2020-11-26 05:41:07 <crestfallen> I think the return clause requires " \_ -> ...". also I thought return requires the State :: ((),s) of write
2020-11-26 05:41:56 <crestfallen> I know it's a strange program, but I want the division by zero error when I use (-1)
2020-11-26 05:42:04 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:42:19 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:42:20 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:42:34 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:42:35 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:42:49 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:42:50 <MarcelineVQ> monochrom made an IO tutorial that happens to cover how bind and do relate, by starting with bind only, http://www.vex.net/~trebla/haskell/IO.xhtml But any google search about do notation in haskell will cover it as well, googling "translating do notation" for instance
2020-11-26 05:42:50 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:43:04 supercoven joins (~Supercove@194.34.133.94)
2020-11-26 05:43:05 × supercoven quits (~Supercove@194.34.133.94) (Max SendQ exceeded)
2020-11-26 05:43:36 <crestfallen> I've been using this: https://en.wikibooks.org/wiki/Haskell/do_notation
2020-11-26 05:44:48 <crestfallen> I can see that there is a slight difference but I don't know how to insert the second read so that the "write (x+1) is maintained downstream
2020-11-26 05:45:35 × guest1126 quits (~user@49.5.6.87) (Remote host closed the connection)
2020-11-26 05:45:45 guest1126 joins (~user@49.5.6.87)
2020-11-26 05:46:47 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-11-26 05:48:12 <MarcelineVQ> That one's fine. You've got all the tools you need there. Just do what they did.Your only difference is that you have 4 '
2020-11-26 05:48:19 <MarcelineVQ> actions' instead of 3.
2020-11-26 05:48:48 <crestfallen> i.e. this doesn't change the behavior to that of 'divv' divvy = read >>= \x -> write (x+1) >>= \_ -> read >>= \_ -> return (safeDiv (x*2) x)
2020-11-26 05:49:11 <MarcelineVQ> no it wouldn't, because you don't bind x again
2020-11-26 05:49:26 <MarcelineVQ> so you're using the old x instead of shadowing a new one like you did in divv
2020-11-26 05:49:54 <crestfallen> yes, thanks I understand, but what is the notation?
2020-11-26 05:50:01 conal joins (~conal@64.71.133.70)
2020-11-26 05:50:37 <MarcelineVQ> :/ write x where you wrote _ in the same way you did it for the first read
2020-11-26 05:51:03 × vg quits (~vg@139.59.59.230) (Quit: vg)
2020-11-26 05:51:18 vg joins (~vg@139.59.59.230)
2020-11-26 05:51:32 × vg quits (~vg@139.59.59.230) (Remote host closed the connection)
2020-11-26 05:51:45 vg joins (~vg@139.59.59.230)
2020-11-26 05:51:53 × vg quits (~vg@139.59.59.230) (Remote host closed the connection)
2020-11-26 05:52:09 vg joins (~vg@139.59.59.230)
2020-11-26 05:52:16 conal_ joins (~conal@64.71.133.70)
2020-11-26 05:52:25 × vg quits (~vg@139.59.59.230) (Remote host closed the connection)
2020-11-26 05:52:31 <crestfallen> geez, I swear MarcelineVQ I thought I had done that 20 times. yes it works thanks kindly.
2020-11-26 05:52:35 <MarcelineVQ> Rather than not getting do notation what is happening here is that you're not getting >>= Otherwise you wouldn't need to ask what you're asking. the expression x >>= \y -> ... binds the result of computing/running/executing x, to the name y.
2020-11-26 05:52:39 vg joins (~vg@139.59.59.230)
2020-11-26 05:53:06 <MarcelineVQ> do notation let's use write this as y <- x but the meaning is the same, run x, call the result y.
2020-11-26 05:53:26 × Fractalis quits (~Fractalis@2601:987:280:8d40:eda9:f9e1:2072:cea7) (Ping timeout: 264 seconds)
2020-11-26 05:54:13 <crestfallen> what is the rule where the lambda after the second >>= must have the wildcard ? MarcelineVQ
2020-11-26 05:54:27 <crestfallen> I'm foggy on that
2020-11-26 05:55:13 × conal quits (~conal@64.71.133.70) (Ping timeout: 246 seconds)
2020-11-26 05:55:38 × adm_ quits (~adm@43.229.88.197) (Remote host closed the connection)
2020-11-26 05:55:55 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-11-26 05:56:14 <jle`> incertia: looks solid to me :)
2020-11-26 05:56:34 <jle`> at least as a parallel to Data.Has
2020-11-26 05:56:41 adm_ joins (~adm@43.229.88.197)
2020-11-26 05:56:54 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-11-26 05:57:02 <incertia> there should be no reason to pick a specific choice right
2020-11-26 05:57:19 <MarcelineVQ> You write _ if you don't care to name the result of some action. If you're not using the result in other words. For instance if you wrote
2020-11-26 05:57:20 <MarcelineVQ> do x
2020-11-26 05:57:23 <MarcelineVQ> y
2020-11-26 05:57:31 <jle`> incertia: what do you mean by specific choice?
2020-11-26 05:57:40 Jonkimi727406120 joins (~Jonkimi@113.87.161.66)
2020-11-26 05:57:50 <jle`> ah my 'at least...' was that i'm still not super comfortable with such polymorphic mptc's
2020-11-26 05:57:58 <jle`> but it should be at least as usable as Data.Has
2020-11-26 05:57:59 <MarcelineVQ> that would be x >>= \_ -> y We don't bind a name for the result of x
2020-11-26 05:58:05 × plutoniix quits (~q@ppp-223-24-94-50.revip6.asianet.co.th) (Ping timeout: 240 seconds)
2020-11-26 05:58:14 <incertia> e.g. in the profunctor construction of lenses we have p a (f b) but we choice p = (->)
2020-11-26 05:58:22 DataComputist joins (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net)
2020-11-26 05:58:29 <jle`> ah, Choice
2020-11-26 05:58:29 <incertia> Prisms appear to apply to anything with Choice
2020-11-26 05:58:51 <incertia> and in such a way we can remove the lens dependency
2020-11-26 05:58:58 <incertia> er profunctors
2020-11-26 05:59:17 <koz_> @hoogle Choice
2020-11-26 05:59:17 <lambdabot> Control.Lens.Combinators class Profunctor p => Choice (p :: Type -> Type -> Type)
2020-11-26 05:59:17 <lambdabot> Control.Lens.Prism class Profunctor p => Choice (p :: Type -> Type -> Type)
2020-11-26 05:59:17 <lambdabot> Network.AWS.Lens class Profunctor p => Choice (p :: Type -> Type -> Type)
2020-11-26 05:59:19 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-11-26 05:59:22 <jle`> yup, you should be ok with using Data.Profunctor.Choice, you don't need a lens dep
2020-11-26 05:59:24 <koz_> Ah that thing.

All times are in UTC.