Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-12 18:21:23 rj joins (~x@gateway/tor-sasl/rj)
2021-03-12 18:22:24 <monochrom> I think if you write the manual recursion, it is recognizable as a foldr.
2021-03-12 18:23:03 <monochrom> Err oops no.
2021-03-12 18:23:13 × crobbins quits (~crobbins@2601:2c1:200:ec50:e447:130a:d760:fb15) (Remote host closed the connection)
2021-03-12 18:23:13 <kuribas> how do you force a trace inside a monad?
2021-03-12 18:23:38 hyperisco joins (~hyperisco@d192-186-117-226.static.comm.cgocable.net)
2021-03-12 18:23:50 <monochrom> go (x:xs) = x : go (dropWhile (\y -> y < x+gap))
2021-03-12 18:23:58 crobbins joins (~crobbins@c-73-76-34-113.hsd1.tx.comcast.net)
2021-03-12 18:24:10 <monochrom> err, go (x:xs) = x : go (dropWhile (\y -> y < x+gap) xs)
2021-03-12 18:24:24 <int-e> kuribas: do you want something like `trace "foo" (return ())`?
2021-03-12 18:24:28 <kuribas> yeah
2021-03-12 18:24:42 × geekosaur quits (82650c7a@130.101.12.122) (Ping timeout: 240 seconds)
2021-03-12 18:24:47 <monochrom> traceM
2021-03-12 18:25:11 <int-e> Oh, that exists... didn't know. In any case, monads tend to be strict in the monad operations, and then this works.
2021-03-12 18:25:20 <kuribas> ah nice
2021-03-12 18:25:25 <monochrom> traceIO, traceM, traceShowM
2021-03-12 18:25:36 <int-e> I knew about traceIO
2021-03-12 18:26:07 <monochrom> "traceM string = trace string $ pure ()" you are not missing anything except more names :)
2021-03-12 18:26:56 × Pickchea quits (~private@unaffiliated/pickchea) (Ping timeout: 256 seconds)
2021-03-12 18:26:58 <int-e> traceM is new-ish, only 7 years old
2021-03-12 18:27:57 hololeap joins (~hololeap@unaffiliated/hololeap)
2021-03-12 18:28:41 × tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Remote host closed the connection)
2021-03-12 18:29:01 × crobbins quits (~crobbins@c-73-76-34-113.hsd1.tx.comcast.net) (Ping timeout: 276 seconds)
2021-03-12 18:30:15 gitgood joins (~gitgood@82-132-216-167.dab.02.net)
2021-03-12 18:30:18 frozenErebus joins (~frozenEre@94.128.82.20)
2021-03-12 18:30:20 <int-e> traceM string = trace string $ pure () -- at least it does exactly what I proposed :)... modulo the obvious AMP change.
2021-03-12 18:31:13 <monochrom> koz_: I think manual recursion is the easiest to follow. I know how to get foldr involved for example, but it is obfuscating.
2021-03-12 18:31:30 <koz_> monochrom: OK, that makes sense. I was just wondering if I was missing something.
2021-03-12 18:31:32 ADG1089__ joins (~aditya@223.226.229.230)
2021-03-12 18:31:59 <monochrom> But dropWhile is going to simplify it a lot.
2021-03-12 18:32:07 waleee-cl joins (uid373333@gateway/web/irccloud.com/x-ztluuxltoyaaemrx)
2021-03-12 18:32:12 <koz_> Agreed - that's a really good suggestion, thanks!
2021-03-12 18:32:29 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2021-03-12 18:32:48 <monochrom> "go (x:xs) = x : go (dropWhile (\y -> y < x+gap) xs)" is basically a direct transcription of your English description.
2021-03-12 18:34:07 geekosaur joins (82650c7a@130.101.12.122)
2021-03-12 18:34:46 × FortuneZero quits (3223b878@50.35.184.120) (Quit: Connection closed)
2021-03-12 18:35:08 <kuribas> traceM "foo" is still only executed once
2021-03-12 18:37:13 gitgoood joins (~gitgood@82-132-218-210.dab.02.net)
2021-03-12 18:38:52 crobbins joins (~crobbins@2600:1700:48eb:8490:64e8:fb97:6b55:2a25)
2021-03-12 18:39:42 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
2021-03-12 18:39:56 × gitgood quits (~gitgood@82-132-216-167.dab.02.net) (Read error: Connection reset by peer)
2021-03-12 18:40:03 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-12 18:40:10 × DTZUZU quits (~DTZUZO@205.ip-149-56-132.net) (Quit: WeeChat 3.1)
2021-03-12 18:41:14 <hyiltiz> Anyone else enjoyed playing https://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game?
2021-03-12 18:42:30 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-12 18:44:57 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 264 seconds)
2021-03-12 18:44:58 × psygate quits (~psygate@unaffiliated/psygate) (Read error: Connection reset by peer)
2021-03-12 18:46:16 × mirrorbird quits (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) (Quit: Leaving)
2021-03-12 18:46:36 jamm_ joins (~jamm@unaffiliated/jamm)
2021-03-12 18:47:40 × elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Read error: Connection reset by peer)
2021-03-12 18:48:59 DTZUZU joins (~DTZUZO@205.ip-149-56-132.net)
2021-03-12 18:50:21 elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de)
2021-03-12 18:51:02 × jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 264 seconds)
2021-03-12 18:51:20 × tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Remote host closed the connection)
2021-03-12 18:51:39 × kuribas quits (~user@ptr-25vy0iacnrjbfn1sihk.18120a2.ip6.access.telenet.be) (Remote host closed the connection)
2021-03-12 18:53:27 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-12 18:54:43 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Max SendQ exceeded)
2021-03-12 18:54:43 borne joins (~fritjof@2a06:8782:ffbb:1337:e811:68d9:a46:a27f)
2021-03-12 18:55:02 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-12 18:55:55 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Max SendQ exceeded)
2021-03-12 18:56:15 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-12 19:00:19 dunj4 joins (~dunj3@p200300f61714a678d85584dd45edd0a4.dip0.t-ipconnect.de)
2021-03-12 19:00:35 × dunj4 quits (~dunj3@p200300f61714a678d85584dd45edd0a4.dip0.t-ipconnect.de) (Client Quit)
2021-03-12 19:01:50 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:948b:9d7e:1b3d:4c5c) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-03-12 19:02:07 pavonia joins (~user@unaffiliated/siracusa)
2021-03-12 19:03:02 × dunj3 quits (~dunj3@p200300f61714a62572ae6a6bffb9249a.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
2021-03-12 19:03:29 berberman_ joins (~berberman@unaffiliated/berberman)
2021-03-12 19:03:38 × berberman quits (~berberman@unaffiliated/berberman) (Ping timeout: 264 seconds)
2021-03-12 19:04:50 × Khisanth quits (~Khisanth@24.sub-174-244-147.myvzw.com) (Read error: Connection reset by peer)
2021-03-12 19:05:10 × rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 268 seconds)
2021-03-12 19:05:53 Solid joins (~blyat@unaffiliated/solid-)
2021-03-12 19:06:02 × Kaiepi quits (~Kaiepi@47.54.252.148) (Ping timeout: 256 seconds)
2021-03-12 19:07:34 nbloomf joins (~nbloomf@76.217.43.73)
2021-03-12 19:07:42 Kaiepi joins (~Kaiepi@47.54.252.148)
2021-03-12 19:08:21 <Solid> so I entered `1 = 2` in ghci and pressed enter and ghci was like "okay sure"
2021-03-12 19:08:38 <Solid> afaik functions can't start with a number, so what's happening here?
2021-03-12 19:08:54 rj joins (~x@gateway/tor-sasl/rj)
2021-03-12 19:09:21 nyaomi joins (~naomi@2603-7080-c43e-59ad-c878-29ff-fedf-ce89.res6.spectrum.com)
2021-03-12 19:09:37 <monochrom> You're looking at the more general: <pattern> = <expr>
2021-03-12 19:10:04 <monochrom> For example "(x,y) = (3,'x')" is OK.
2021-03-12 19:10:15 <monochrom> For example "Just x = Just 3" is OK.
2021-03-12 19:10:41 <Solid> a single number can be part of a pattern? :o
2021-03-12 19:10:53 <Solid> s/part of//
2021-03-12 19:10:59 <geekosaur> but something like 1 = 2 is never tested, since it has no bindings
2021-03-12 19:11:11 <monochrom> Now add laziness. "<pattern> = <expr>" doesn't do the necessary pattern matching right away. So "Nothing = Just 3" and "Just x = Nothing" are also OK.
2021-03-12 19:11:45 <monochrom> And lastly, number literals and string literals are also patterns.
2021-03-12 19:11:56 <Solid> oooooh that makes sense
2021-03-12 19:11:58 <Solid> thanks :)
2021-03-12 19:12:05 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2021-03-12 19:12:19 <Solid> indeed, let !1 = 2 in 1 makes it blow up
2021-03-12 19:12:27 <monochrom> :)
2021-03-12 19:12:36 × average quits (uid473595@gateway/web/irccloud.com/x-ccphdwzehpjwbayw) (Quit: Connection closed for inactivity)
2021-03-12 19:13:13 <hololeap> what is the point of WrappedMonad. is that from before Applicative was a superclass of Monad?
2021-03-12 19:14:55 <monochrom> Looks like so.
2021-03-12 19:15:10 <monochrom> And carrying MonadPlus to Alternative
2021-03-12 19:15:17 × nyaomi quits (~naomi@2603-7080-c43e-59ad-c878-29ff-fedf-ce89.res6.spectrum.com) (Ping timeout: 260 seconds)
2021-03-12 19:15:24 <hololeap> i'm trying to find some kind of wrapper that gives a Monad a Bind instance, but i'm not seeing one here
2021-03-12 19:15:26 <hololeap> https://hackage.haskell.org/package/semigroupoids-5.1/docs/Data-Functor-Bind.html
2021-03-12 19:16:43 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds)
2021-03-12 19:19:39 <hololeap> oh, nvm, it's literally using the thing i just asked about, Control.Applicative.WrappedMonad :p

All times are in UTC.