2025/02/11

Newest at the top

2025-02-11 19:42:01 +0100Guest93(~Guest93@pool-96-250-224-152.nycmny.fios.verizon.net) (Client Quit)
2025-02-11 19:41:21 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds)
2025-02-11 19:41:18 +0100Lord_of_Life_Lord_of_Life
2025-02-11 19:41:06 +0100Guest93(~Guest93@pool-96-250-224-152.nycmny.fios.verizon.net)
2025-02-11 19:40:48 +0100Lord_of_Life(~Lord@user/lord-of-life/x-2819915) (Ping timeout: 252 seconds)
2025-02-11 19:39:54 +0100Lord_of_Life_(~Lord@user/lord-of-life/x-2819915) Lord_of_Life
2025-02-11 19:37:30 +0100 <EvanR> (A -> a, A <- b)
2025-02-11 19:37:09 +0100 <monochrom> lambda the ultimate goto. (->) the ultimate instance.
2025-02-11 19:36:40 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-02-11 19:35:58 +0100 <ncf> (->) is the canonical example
2025-02-11 19:35:42 +0100 <euouae> oh I see. hm.. I'll keep it in mind when I encounter it
2025-02-11 19:34:59 +0100 <EvanR> profunctor class is for types which are functor in one parameter and contravariant functor in the other
2025-02-11 19:34:18 +0100 <euouae> yes
2025-02-11 19:34:03 +0100 <EvanR> do you know what a contravariant functor is
2025-02-11 19:33:41 +0100 <euouae> what's a profunctor?
2025-02-11 19:33:34 +0100 <monochrom> But I think weakening to functor is impossible.
2025-02-11 19:33:01 +0100 <monochrom> perhaps s/pattern/generalization/
2025-02-11 19:32:41 +0100 <EvanR> lol
2025-02-11 19:32:37 +0100 <tomsmeding> I'm not sure if a "pattern" is the right way to look at those :P
2025-02-11 19:32:33 +0100 <monochrom> Application: Suppose you want a procedure foo such that foo n reads n lines from stdin and return the list of those n lines. Then it is: sequenceA (replicate n getLine)
2025-02-11 19:32:13 +0100 <EvanR> haskell hasn't figured this one out yet
2025-02-11 19:31:44 +0100 <EvanR> the next in the pattern would be something of the form (Traversable t, Functor f) => t (f a) -> f (t a)
2025-02-11 19:31:30 +0100TheCoffeMaker(~TheCoffeM@user/thecoffemaker) TheCoffeMaker
2025-02-11 19:30:53 +0100 <monochrom> OK yeah sequenceA.
2025-02-11 19:30:52 +0100 <haskellbridge> <alexfmpe> * only works when there's
2025-02-11 19:30:42 +0100 <lambdabot> (Traversable t, Applicative f) => t (f a) -> f (t a)
2025-02-11 19:30:41 +0100 <EvanR> :t sequenceA
2025-02-11 19:30:36 +0100 <lambdabot> (Traversable t, Monad m) => t (m a) -> m (t a)
2025-02-11 19:30:35 +0100 <EvanR> :t sequence
2025-02-11 19:30:30 +0100jespada(~jespada@2800:a4:2230:3e00:3974:82a3:7f20:1404) jespada
2025-02-11 19:29:41 +0100 <monochrom> If you accept sequence, then traverse is just sequence and fmap.
2025-02-11 19:29:32 +0100 <haskellbridge> <alexfmpe> * suitable combining
2025-02-11 19:29:25 +0100JeremyB99(~JeremyB99@2607:fb90:d362:29:704c:ca03:6a71:2d6c) (Ping timeout: 268 seconds)
2025-02-11 19:29:22 +0100 <monochrom> You can then go ambitious and say "but liftA10 is always 10. can I make it variable length?". Answer: sequence accepts an arbitary list so it's variable length. (The compromise is that we only have homogeneous lists, so the input list has to be homogeneous, whereas liftA10 is OK with 10 different types.)
2025-02-11 19:29:15 +0100 <haskellbridge> Traverse is fmap followed by sequence, so it's kind of foldMap with applicative
2025-02-11 19:29:13 +0100 <haskellbridge> <alexfmpe> Yeah, I'd say sequence is basically folding with applicative, but with a fold function that preserves the original structure.
2025-02-11 19:27:34 +0100 <monochrom> Remember how you can DIY liftA10, liftA11, liftA12 etc by pure and a lot of liftA2?
2025-02-11 19:27:04 +0100peterbecich(~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich
2025-02-11 19:26:52 +0100 <monochrom> It may be useful motivate why one would want it.
2025-02-11 19:26:32 +0100 <monochrom> If I'm allowed to illustrate sequence instead: sequence [foo, goo, hoo] = liftA2 (:) foo (liftA2 (:) goo (liftA2 (:) hoo (pure [])))))
2025-02-11 19:25:48 +0100ljdarj(~Thunderbi@user/ljdarj) ljdarj
2025-02-11 19:25:40 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
2025-02-11 19:24:48 +0100lisbeths(uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity)
2025-02-11 19:24:18 +0100JeremyB99(~JeremyB99@2607:fb90:d362:29:704c:ca03:6a71:2d6c)
2025-02-11 19:24:09 +0100JeremyB99(~JeremyB99@172.59.98.128) (Remote host closed the connection)
2025-02-11 19:23:50 +0100TheCoffeMaker(~TheCoffeM@user/thecoffemaker) (Remote host closed the connection)
2025-02-11 19:23:46 +0100 <justsomeguy> Maybe I just have to write it out on paper.
2025-02-11 19:23:32 +0100 <justsomeguy> At this point the examples make sense, but I'm not sure how they evaluate.
2025-02-11 19:22:37 +0100JeremyB99(~JeremyB99@172.59.98.128)
2025-02-11 19:21:46 +0100 <monochrom> If it helps: traverse is impure fmap.