Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 687 688 689 690 691 692 693 694 695 696 697 .. 5022
502,152 events total
2020-10-17 02:27:20 <ddellacosta> so it just executes a's effect and calls itself again
2020-10-17 02:27:34 <c_wraith> ok. the definition you quoted does the same thing, but with a knot-tying trick in order to reduce potential overhead
2020-10-17 02:27:49 <monochrom> "forever" is most useful if you use it for IO and go something like "forever (putStrLn "Your PC is stoned")"
2020-10-17 02:28:19 <ddellacosta> c_wraith: okay! I get it! Thank you so much
2020-10-17 02:28:20 ephemera_ joins (~E@122.34.1.187)
2020-10-17 02:28:34 <monochrom> It is clearly useless if you try "forever Nothing" or "forever (Just 4)"
2020-10-17 02:28:37 <c_wraith> you're welcome
2020-10-17 02:29:05 <ddellacosta> monochrom: yeah, actually I have used it a bunch but all of a sudden realized I didn't know how it was defined, so then I went to take a look and got confused
2020-10-17 02:29:26 Tario joins (~Tario@201.192.165.173)
2020-10-17 02:29:54 <c_wraith> > forever Nothing
2020-10-17 02:29:57 <lambdabot> Nothing
2020-10-17 02:30:03 <c_wraith> that hardly took forever at all!
2020-10-17 02:30:04 <monochrom> So now you're ready for "fix f = let x = f x in x", too. TEE HEE HEE
2020-10-17 02:30:13 <iqubic> > forever (Just 4)
2020-10-17 02:30:17 <lambdabot> *Exception: <<loop>>
2020-10-17 02:30:22 lagothrix is now known as Guest94488
2020-10-17 02:30:30 lagothrix joins (~lagothrix@unaffiliated/lagothrix)
2020-10-17 02:30:30 HarveyPwca joins (~HarveyPwc@c-98-220-98-201.hsd1.il.comcast.net)
2020-10-17 02:30:45 chris joins (~chris@81.96.113.213)
2020-10-17 02:30:46 <ddellacosta> monochrom: you're making me remember when I spent a week learning recursion schemes, and I have mostly forgetten them at this point
2020-10-17 02:30:48 <iqubic> Oh, that's just "Just (Just (Just (Just (Just (Just ...)))))" With a 4 at the bottom of the infinite stack.
2020-10-17 02:30:49 <ddellacosta> forgotten
2020-10-17 02:31:02 <ddellacosta> _sigh_
2020-10-17 02:31:08 <c_wraith> iqubic: actually it isn't.
2020-10-17 02:31:08 chris is now known as Guest78718
2020-10-17 02:31:15 <ddellacosta> I need to figure out how to retain all the haskell I've forgotten
2020-10-17 02:31:18 <iqubic> Oh? How come?
2020-10-17 02:31:32 <c_wraith> iqubic: it's Just 4 *> (Just 4 *> (Just 4 *> ...
2020-10-17 02:31:36 <monochrom> Age of Empires Infinity: The Forgotton Recursions: Definitive Edition
2020-10-17 02:31:52 <c_wraith> iqubic: Just 4 *> Just 3
2020-10-17 02:32:01 × Guest78718 quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-10-17 02:32:02 <iqubic> Right, but what does (*>) do for Maybe?
2020-10-17 02:32:05 <larou> % Just 4 *> Just 3
2020-10-17 02:32:06 <yahb> larou: Just 3
2020-10-17 02:32:08 <c_wraith> > Just 4 *> Just 3
2020-10-17 02:32:10 <lambdabot> Just 3
2020-10-17 02:32:33 <c_wraith> :t (*>)
2020-10-17 02:32:33 <iqubic> @src (*>)
2020-10-17 02:32:34 <lambdabot> (*>) = liftA2 (const id)
2020-10-17 02:32:35 <lambdabot> Applicative f => f a -> f b -> f b
2020-10-17 02:32:57 <c_wraith> Notably, it doesn't add a layer of f
2020-10-17 02:33:00 <ddellacosta> monochrom: that definitely sounds like a game that would suck up a lot of time
2020-10-17 02:33:09 <iqubic> I'm so confused by that definition?
2020-10-17 02:33:11 <monochrom> It took me about 3 re-learnings to retain catamorphisms, so don't worry.
2020-10-17 02:33:23 × Guest94488 quits (~lagothrix@unaffiliated/lagothrix) (Ping timeout: 260 seconds)
2020-10-17 02:33:45 <larou> oh, i had a fun thing
2020-10-17 02:33:50 <monochrom> But buy one get one free, retaining catamorphisms implies retaining anamorphisms.
2020-10-17 02:34:10 <monochrom> After that, I simply declared that the rest of recursion schemes are not worth my time.
2020-10-17 02:34:17 <larou> a list of maybe Int, where the Int points to the location of another Int somewhere else in the list
2020-10-17 02:34:18 × machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 272 seconds)
2020-10-17 02:34:28 <larou> and you have to constrain it so the ints "point to each other"
2020-10-17 02:34:36 thir joins (~thir@p200300f27f02580074cf2a3fa9ab5ee7.dip0.t-ipconnect.de)
2020-10-17 02:34:42 × ephemera_ quits (~E@122.34.1.187) (Ping timeout: 260 seconds)
2020-10-17 02:34:42 <monochrom> Instead, Ralf Hinze's "adjoint folds and unfolds" are actually elegant and not ad hoc.
2020-10-17 02:34:51 <c_wraith> iqubic: fa *> fb = (\_ y -> y) <$> fa <*> fb -- is this more comfortable of a definition?
2020-10-17 02:34:57 <ddellacosta> I mean, I think folds are really cool and fundamental and I love how it like turns them inside out
2020-10-17 02:35:00 ephemera_ joins (~E@122.34.1.187)
2020-10-17 02:35:08 <ddellacosta> monochrom: oh, I'll check it out, thanks
2020-10-17 02:35:23 × clmg quits (~clmg@2601:1c2:200:720:4114:54ca:ed6a:7bde) (Quit: Leaving)
2020-10-17 02:35:26 <iqubic> :t const
2020-10-17 02:35:27 <lambdabot> a -> b -> a
2020-10-17 02:36:02 <iqubic> Wait a minute...? Isn't "const id" just the same as "flip const"
2020-10-17 02:36:08 <ddellacosta> haha "Or: Scything Through the Thicket of Morphisms"
2020-10-17 02:36:59 <iqubic> If my last statement is true, then I fully understand how "liftA2 (const id)" works.
2020-10-17 02:37:38 × noctux quits (~noctux@unaffiliated/noctux) (Ping timeout: 256 seconds)
2020-10-17 02:37:54 <iqubic> Wait... no, not really. Where does the loop get introduced? What causes the infinite recursion there.
2020-10-17 02:38:28 <c_wraith> which "there" do you mean?
2020-10-17 02:39:30 <iqubic> "liftA2 (const id)" creates what is the equivalent of an infinite loop. How does that function introduce infinite recursion?
2020-10-17 02:39:31 × AlterEgo- quits (~ladew@124-198-158-163.dynamic.caiway.nl) (Read error: Connection reset by peer)
2020-10-17 02:39:52 <c_wraith> I think you've mixed things up. (*>) doesn't introduce recursion, forever does
2020-10-17 02:40:09 <iqubic> Oh. I see.
2020-10-17 02:40:38 <iqubic> "liftA2 (const id)" is the default implementation of (*>). That clears things up.
2020-10-17 02:41:06 <iqubic> Now, does "const id" do the same thing as "flip const"?
2020-10-17 02:41:07 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds)
2020-10-17 02:41:12 <iqubic> :t const id
2020-10-17 02:41:14 <lambdabot> b -> a -> a
2020-10-17 02:41:19 <iqubic> :t flip const
2020-10-17 02:41:20 <lambdabot> b -> c -> c
2020-10-17 02:41:25 × ephemera_ quits (~E@122.34.1.187) (Ping timeout: 240 seconds)
2020-10-17 02:43:02 Jonkimi727406120 joins (~Jonkimi@223.213.79.20)
2020-10-17 02:43:03 × da39a3ee5e6b4b0d quits (~textual@n11211935170.netvigator.com) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-10-17 02:43:11 ephemera_ joins (~E@122.34.1.187)
2020-10-17 02:43:31 <iqubic> From those very generic and unconstrained type signatures being the same, I conclude that they two different implementations of the same function.
2020-10-17 02:43:42 <sshine> :t liftA2 (const id)
2020-10-17 02:43:43 <lambdabot> Applicative f => f b -> f c -> f c
2020-10-17 02:43:58 <sshine> :t liftA2 (\a b -> b)
2020-10-17 02:44:00 <lambdabot> Applicative f => f a -> f c -> f c
2020-10-17 02:44:22 <sshine> :t (*>)
2020-10-17 02:44:23 <lambdabot> Applicative f => f a -> f b -> f b
2020-10-17 02:44:42 <iqubic> :t liftA2 (flip const)
2020-10-17 02:44:44 <lambdabot> Applicative f => f b -> f c -> f c
2020-10-17 02:44:55 × nados quits (~dan@107-190-41-58.cpe.teksavvy.com) (Quit: Leaving)
2020-10-17 02:45:35 albertus11 joins (~seb@x4db49541.dyn.telefonica.de)
2020-10-17 02:48:52 × albertus1 quits (~seb@x4db5a1e1.dyn.telefonica.de) (Ping timeout: 272 seconds)
2020-10-17 02:49:43 × carlomagno quits (~cararell@inet-hqmc02-o.oracle.com) (Ping timeout: 260 seconds)
2020-10-17 02:51:06 carlomagno joins (~cararell@inet-hqmc02-o.oracle.com)
2020-10-17 02:55:11 noctux joins (~noctux@unaffiliated/noctux)
2020-10-17 02:55:25 × djellemah quits (~djellemah@2601:5c2:100:96c:e008:b638:39fe:6a54) (Ping timeout: 244 seconds)
2020-10-17 02:55:40 <sshine> const id = (\b c -> b) (\a -> a) = (\c -> (\a -> a)) = (\c a -> a)
2020-10-17 02:55:59 <sshine> flip const = (\f y x -> f x y) (\b c -> b) = (\y x -> (\b c -> b) x y) = (\y x -> x)

All times are in UTC.