Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-15 11:13:52 jayok joins (~jayok@cpc147358-belf12-2-0-cust581.2-1.cable.virginm.net)
2021-03-15 11:14:12 mirrorbird joins (dwsjeid911@gateway/vpn/mullvad/dwsjeid911)
2021-03-15 11:15:28 × idhugo_ quits (~idhugo@80-62-116-51-mobile.dk.customer.tdc.net) (Ping timeout: 245 seconds)
2021-03-15 11:16:27 elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de)
2021-03-15 11:17:57 × __minoru__shirae quits (~shiraeesh@46.34.206.121) (Ping timeout: 246 seconds)
2021-03-15 11:18:48 × geowiesnot_bis quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 245 seconds)
2021-03-15 11:19:16 × koz_ quits (~koz@121.99.240.58) (Ping timeout: 276 seconds)
2021-03-15 11:19:22 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
2021-03-15 11:20:30 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:20:57 × jayok quits (~jayok@cpc147358-belf12-2-0-cust581.2-1.cable.virginm.net) (Ping timeout: 264 seconds)
2021-03-15 11:25:39 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds)
2021-03-15 11:26:37 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:29:03 koz joins (~koz@121.99.240.58)
2021-03-15 11:32:06 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2021-03-15 11:32:27 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:33:32 × jumper149 quits (~jumper149@ip185225.wh.uni-hannover.de) (Quit: WeeChat 3.1)
2021-03-15 11:34:17 jumper149 joins (~jumper149@ip185225.wh.uni-hannover.de)
2021-03-15 11:35:04 × jumper149 quits (~jumper149@ip185225.wh.uni-hannover.de) (Client Quit)
2021-03-15 11:35:24 jumper149 joins (~jumper149@ip185225.wh.uni-hannover.de)
2021-03-15 11:35:37 × jumper149 quits (~jumper149@ip185225.wh.uni-hannover.de) (Client Quit)
2021-03-15 11:35:54 jamm_ joins (~jamm@unaffiliated/jamm)
2021-03-15 11:36:37 jumper149 joins (~jumper149@ip185225.wh.uni-hannover.de)
2021-03-15 11:37:45 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds)
2021-03-15 11:37:54 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:37:58 machinedgod joins (~machinedg@135-23-192-217.cpe.pppoe.ca)
2021-03-15 11:39:42 nhs joins (~nhs@cpe-70-113-67-118.austin.res.rr.com)
2021-03-15 11:40:14 × jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 264 seconds)
2021-03-15 11:40:25 × hexfive quits (~hexfive@50.35.83.177) (Quit: i must go. my people need me.)
2021-03-15 11:40:39 curiousgay seeing laws of monads
2021-03-15 11:40:44 <curiousgay> my brain: that hurts
2021-03-15 11:41:53 <mouseghost> curiousgay, everyone was there, i think
2021-03-15 11:42:00 <jumper149> curiousgay: Specific to Monad is just the bind operator >>=
2021-03-15 11:42:08 <mouseghost> nice username btw
2021-03-15 11:42:21 <jumper149> curiousgay: The rest is built up on other typeclasses
2021-03-15 11:43:04 <jumper149> Maybe that will help you distinguish the laws from one another
2021-03-15 11:43:09 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds)
2021-03-15 11:43:43 gzj joins (~gzj@unaffiliated/gzj)
2021-03-15 11:44:01 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:44:14 <curiousgay> mouseghost: thanks, you're the first one commenting my nick :)
2021-03-15 11:44:29 × nhs quits (~nhs@cpe-70-113-67-118.austin.res.rr.com) (Ping timeout: 265 seconds)
2021-03-15 11:44:59 <mouseghost> :D
2021-03-15 11:45:52 bergey` joins (~user@pool-74-108-99-127.nycmny.fios.verizon.net)
2021-03-15 11:47:36 <curiousgay> jumper149: `xs >>= return . f = fmap f xs` is so mind blowing
2021-03-15 11:47:46 × mirrorbird quits (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) (Quit: Leaving)
2021-03-15 11:48:00 epstein joins (dwsjeid911@gateway/vpn/mullvad/dwsjeid911)
2021-03-15 11:49:21 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
2021-03-15 11:49:31 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:51:45 <jumper149> curiousgay: It's important to understand why that works, but from a practical perspective the lhs is kind of an antipattern.
2021-03-15 11:52:36 <enikar> curiousgay: use lambda to understand.
2021-03-15 11:54:12 __minoru__shirae joins (~shiraeesh@46.34.206.121)
2021-03-15 11:54:51 <enikar> xs >>= return . f = xs >>= (\x -> return (f x))
2021-03-15 11:55:01 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
2021-03-15 11:55:06 × gzj quits (~gzj@unaffiliated/gzj) (Remote host closed the connection)
2021-03-15 11:55:19 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-15 11:55:26 gzj joins (~gzj@unaffiliated/gzj)
2021-03-15 11:56:36 <enikar> if xs :: m a, then (\x -> return (f x)) should be 'm b', then the type of is: f :: a -> b
2021-03-15 11:57:23 <enikar> because (>>=) :: m a -> (\a -> m b) -> m b)
2021-03-15 11:58:53 curiousgay still thinking how it's equivalent to Functor
2021-03-15 11:58:58 <enikar> then: f :: a -> b
2021-03-15 11:59:04 × divVerent quits (~divVerent@xonotic/core-team/divVerent) (Quit: WeeChat 2.3)
2021-03-15 12:00:12 usr25 joins (~usr25@unaffiliated/usr25)
2021-03-15 12:01:15 <enikar> curiousgay: the first time, it was difficult also for me, anyway.
2021-03-15 12:01:25 <jumper149> curiousgay: That's why I call it an antipattern. (>>=) binds monadic values (xs :: m a) to monadic functions (f :: a -> m b).
2021-03-15 12:01:58 <jumper149> But your example with `xs >>= return . f` doesn't care what kind of function f is.
2021-03-15 12:02:13 <jumper149> Instead you turn it into a monadic function by adding the `return`.
2021-03-15 12:02:52 geekosaur joins (ac3a3c95@172.58.60.149)
2021-03-15 12:02:53 <jumper149> So the `return` wasn't necessary at all. Should have just used `fmap` :p
2021-03-15 12:04:29 <systemfault> > join . fmap (\x -> [x, x]) $ [1,2,3]
2021-03-15 12:04:31 <enikar> we can express the type just for list. If xs :: [a], then: return (f x) = [f x] :: [b].
2021-03-15 12:04:31 <lambdabot> [1,1,2,2,3,3]
2021-03-15 12:06:41 jamm_ joins (~jamm@unaffiliated/jamm)
2021-03-15 12:07:10 <curiousgay> jumper149: I'm thinking about functor instance on the left...
2021-03-15 12:08:01 × carldd quits (~carldd@90-224-49-113-no56.tbcn.telia.com) (Ping timeout: 276 seconds)
2021-03-15 12:08:25 carldd joins (~carldd@90-224-49-113-no56.tbcn.telia.com)
2021-03-15 12:09:09 <curiousgay> enikar: it looks like an implicit call to map
2021-03-15 12:09:29 <enikar> yes indeed.
2021-03-15 12:09:30 <merijn> curiousgay: That's because "map" *is* fmap for lists :p
2021-03-15 12:09:39 <jumper149> @src map
2021-03-15 12:09:39 <lambdabot> map _ [] = []
2021-03-15 12:09:39 <lambdabot> map f (x:xs) = f x : map f xs
2021-03-15 12:09:50 <geekosaur> @src [] fmap
2021-03-15 12:09:50 <lambdabot> fmap = map
2021-03-15 12:10:35 × jespada quits (~jespada@90.254.243.187) (Ping timeout: 265 seconds)
2021-03-15 12:11:26 × jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 264 seconds)
2021-03-15 12:11:59 jespada joins (~jespada@90.254.243.187)
2021-03-15 12:13:55 codygman__ joins (~user@47.186.207.161)
2021-03-15 12:15:00 <enikar> :t [1..3] >>= return .show
2021-03-15 12:15:03 <curiousgay> merijn: I mean that (>>=) takes every element in the list and transforms them just like map
2021-03-15 12:15:03 <lambdabot> [String]
2021-03-15 12:15:17 <enikar> :t fmap show [1..3]
2021-03-15 12:15:19 <lambdabot> [String]
2021-03-15 12:16:55 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
2021-03-15 12:17:14 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-15 12:17:22 <merijn> curiousgay: >>= is more like concatMap
2021-03-15 12:17:25 <enikar> perhaps, it's easier to think in the other direction, I mean, write fmap with >>=
2021-03-15 12:17:26 <merijn> :t concatMap
2021-03-15 12:17:27 × miklcct quits (quasselcor@2001:19f0:7001:5ad:5400:2ff:feb6:50d7) (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
2021-03-15 12:17:27 <lambdabot> Foldable t => (a -> [b]) -> t a -> [b]
2021-03-15 12:17:39 <merijn> In fact, >>= *is* concatMap with a different argument order :p
2021-03-15 12:18:07 <curiousgay> lol

All times are in UTC.