2024/06/30

Newest at the top

2024-06-30 19:57:36 +0200 <mreh> Is there an equivalent to a Map at the type level?
2024-06-30 19:53:51 +0200 <Lawrence1erkheim> I think I get currying now*
2024-06-30 19:53:51 +0200tromp(~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
2024-06-30 19:53:46 +0200 <Lawrence1erkheim> Wait no, let me fix that
2024-06-30 19:53:41 +0200 <Lawrence1erkheim> I get currying now
2024-06-30 19:53:33 +0200 <Lawrence1erkheim> Oh my lord computerphile are so goated
2024-06-30 19:53:16 +0200 <monochrom> A while ago I also thought about how to make >>= more theoretically pleasing. I haven't finished, but I think the first step is to flip the argument order, (a -> m b) -> (m a -> m b). Then it is just the unsurprising functor from the Kleisli category back to the original category.
2024-06-30 19:48:10 +0200 <lambdabot> (a -> b) -> a -> b
2024-06-30 19:48:09 +0200 <probie> :t ($)
2024-06-30 19:48:07 +0200 <lambdabot> Monad m => (a -> m b) -> m a -> m b
2024-06-30 19:48:06 +0200 <probie> :t (=<<)
2024-06-30 19:48:02 +0200 <lambdabot> a -> (a -> b) -> b
2024-06-30 19:48:01 +0200 <probie> :t (&)
2024-06-30 19:48:00 +0200 <lambdabot> Monad m => m a -> (a -> m b) -> m b
2024-06-30 19:47:58 +0200 <probie> :t (>>=)
2024-06-30 19:47:44 +0200 <probie> I'd say it's closer to `(.)`/`(&)`
2024-06-30 19:47:35 +0200 <lambdabot> Functor f => f a -> (a -> b) -> f b
2024-06-30 19:47:33 +0200 <mreh> :t (<&>)
2024-06-30 19:47:17 +0200 <Rembane> It's sadly quite hard to mix (<&>) and (>=>)
2024-06-30 19:46:55 +0200 <geekosaur> )
2024-06-30 19:46:52 +0200 <geekosaur> (the former being (>>=)
2024-06-30 19:46:43 +0200 <geekosaur> right, but you more often use pure computations in monadic contexts than you compose monadic operations
2024-06-30 19:46:40 +0200 <Rembane> ncf: Yes! Just add monads!
2024-06-30 19:46:26 +0200 <ncf> the (>=>)/(>>=) debate should be entirely analogous to the (.)/($) debate
2024-06-30 19:46:17 +0200 <Rembane> Monad composition
2024-06-30 19:46:14 +0200 <Rembane> Nah, it's composition
2024-06-30 19:46:12 +0200 <probie> I use `(>>=)` a lot more than `(>=>)`. `(>=>)` is nice for stating the laws because it's pretty much composition, but using it is about as ergonomic as writing all functions point-free
2024-06-30 19:46:07 +0200 <lambdabot> Monad m => (a -> m b) -> (b -> m c) -> a -> m c
2024-06-30 19:46:06 +0200 <Rembane> :t (>=>)
2024-06-30 19:46:03 +0200 <jackdk> I find that teaching is good for highlighting how `do`-notation works, and the sort of code that people usually write. I find that `(>=>)` is good for highlighting the laws in an obvious way, and highlighting `join` makes it map more cleanly to the traditional definitions. It is often a good exercise to ask people to write each in terms of the other two.
2024-06-30 19:46:02 +0200 <Rembane> I don't think you have to interact with tuples, let me see...
2024-06-30 19:45:59 +0200 <ncf> tuples?
2024-06-30 19:45:13 +0200 <monochrom> And you know it's true because why else the Arrow people went out of their way to invent do-proc notation.
2024-06-30 19:44:46 +0200 <monochrom> With >=>, you have to introduce tuples and then eliminate them. It is indirect, it's an encoding. I am not even commenting on efficiency performance. I am commenting on whether you write what you mean or you write a translation and then the reader has to untranslate.
2024-06-30 19:44:38 +0200 <Rembane> That's true, there's a quite straightforward mechanical translation between them that can be done in the head too!
2024-06-30 19:43:00 +0200 <monochrom> You often need the equivalent of "... >>= \x -> ... x occurs a million times in a million levels of scopes ...". With >>= or do, you just write exactly that directly.
2024-06-30 19:42:27 +0200nhar(~noah@99-112-0-41.lightspeed.tukrga.sbcglobal.net)
2024-06-30 19:42:15 +0200 <Rembane> Sweet!
2024-06-30 19:41:55 +0200 <monochrom> But I think I can describe why it's more pragmatic.
2024-06-30 19:40:53 +0200dcoutts(~duncan@ip-185-104-136-57.ptr.icomera.net)
2024-06-30 19:40:48 +0200L29Ah(~L29Ah@wikipedia/L29Ah)
2024-06-30 19:38:08 +0200 <monochrom> Just frequency in code people write.
2024-06-30 19:37:18 +0200 <Rembane> monochrom: Got it! What makes it more idiomatic?
2024-06-30 19:36:52 +0200pavonia(~user@user/siracusa)
2024-06-30 19:36:29 +0200 <monochrom> I don't know. I stick to >>= because it is more pragmatic and idiomatic.
2024-06-30 19:35:52 +0200 <monochrom> Plus, no one ever asked me for Haskell tutoring. It's always boring stuff like discrete math and NP-completeness....
2024-06-30 19:35:38 +0200 <Rembane> monochrom: Which one of (>>=) and (>=>) is easiest to teach?
2024-06-30 19:35:21 +0200 <monochrom> OK my situation is just because I have already got teaching contracts at uni, so I don't need more monetization.
2024-06-30 19:35:08 +0200bitdex_(~bitdex@gateway/tor-sasl/bitdex)
2024-06-30 19:34:32 +0200 <monochrom> Hahaha that means I am like those barristers in some countries. Not allowed to advertise and seek clients. Must sit there wait for solicitors to forward clients.