Logs: freenode/#haskell
| 2020-10-20 06:54:26 | → | danvet joins (~danvet@2a02:168:57f4:0:5f80:650d:c6e6:3453) |
| 2020-10-20 06:54:45 | × | isovector1 quits (~isovector@172.103.216.166) (Ping timeout: 240 seconds) |
| 2020-10-20 06:54:51 | → | thir joins (~thir@p200300f27f0b040039cda3b6fce8e5af.dip0.t-ipconnect.de) |
| 2020-10-20 06:55:09 | → | jedws joins (~jedws@121.209.161.98) |
| 2020-10-20 06:56:36 | → | mananamenos joins (~mananamen@84.122.202.215.dyn.user.ono.com) |
| 2020-10-20 06:57:49 | → | asheshambasta joins (~user@ptr-e1lysawl9rr13i61o92.18120a2.ip6.access.telenet.be) |
| 2020-10-20 06:58:12 | × | GyroW quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
| 2020-10-20 06:58:28 | → | GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) |
| 2020-10-20 06:58:28 | × | GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host) |
| 2020-10-20 06:58:28 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-20 06:59:18 | × | fryguybob quits (~fryguybob@cpe-74-65-31-113.rochester.res.rr.com) (Ping timeout: 256 seconds) |
| 2020-10-20 06:59:31 | × | thir quits (~thir@p200300f27f0b040039cda3b6fce8e5af.dip0.t-ipconnect.de) (Ping timeout: 272 seconds) |
| 2020-10-20 06:59:33 | → | fryguybob joins (~fryguybob@cpe-74-65-31-113.rochester.res.rr.com) |
| 2020-10-20 06:59:33 | <asheshambasta> | Hi everyone, reflex-platform (?) related question. How does one override packages when using reflex-platform.project? I so far have: https://gist.github.com/asheshambasta/b18f21bc0bdf78b33b02cb846f4b83fe (based off https://github.com/srid/reflex-stone) where I'm trying to add the bulmex package. |
| 2020-10-20 06:59:39 | <asheshambasta> | (I'm also using niv here) |
| 2020-10-20 07:00:37 | <asheshambasta> | I can enter a nix-shell; but I get a "called without default argument "bulmex-custom"" error. |
| 2020-10-20 07:01:48 | <asheshambasta> | (when firing up cabal; which has bulmex-custom as one of its dependencies.) |
| 2020-10-20 07:03:17 | → | Echosolace joins (~Echosolac@p790105-ipngn4101hiraide.tochigi.ocn.ne.jp) |
| 2020-10-20 07:03:48 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-20 07:04:50 | <Echosolace> | Hey, newb here looking at sum . replicate 5 . max 6.7 $ 8.9 |
| 2020-10-20 07:05:00 | <Echosolace> | Can someone tell me if my understanding is correct? |
| 2020-10-20 07:05:05 | <Echosolace> | It goes like this - |
| 2020-10-20 07:05:07 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-20 07:05:23 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-20 07:07:33 | <Echosolace> | max calls two parameters, so we are left with max 6.7 and a variable, let's call it a. It's a partial function, which is then called by replicate, which leaves us with a list that looks like this: [max 6.7 a, max 6.7 a, max 6.7 a, max 6.7 a, max 6.7 a]. Sum is called on that list, but now since a is undefined, it finally reaches out and replaces a with 8.9 and sums 5 x 8.9. |
| 2020-10-20 07:08:47 | × | jedws quits (~jedws@121.209.161.98) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-10-20 07:10:05 | <merijn> | Echosolace: Not really |
| 2020-10-20 07:10:12 | <Echosolace> | Sigh* |
| 2020-10-20 07:10:13 | <suzu_> | you have it backwards |
| 2020-10-20 07:10:14 | × | Sgeo quits (~Sgeo@ool-18b982ad.dyn.optonline.net) (Read error: Connection reset by peer) |
| 2020-10-20 07:10:22 | <merijn> | Echosolace: You are overthinking the partial application thing |
| 2020-10-20 07:10:49 | <merijn> | Echosolace: Let's work backwards rewriting things |
| 2020-10-20 07:10:54 | <Echosolace> | Ok |
| 2020-10-20 07:11:00 | <merijn> | $ has the lowest precedence, so we start there |
| 2020-10-20 07:11:08 | <merijn> | f $ x = f x |
| 2020-10-20 07:11:09 | <Echosolace> | Yep. Everything to the left first. |
| 2020-10-20 07:11:10 | <merijn> | So |
| 2020-10-20 07:11:26 | <merijn> | (sum . replicate 5 . max 6.7) 8.9 |
| 2020-10-20 07:11:39 | <Echosolace> | Yes. |
| 2020-10-20 07:11:40 | × | Plantain quits (~mdomin45@cpe-24-211-129-187.nc.res.rr.com) (Ping timeout: 272 seconds) |
| 2020-10-20 07:11:51 | <merijn> | f . g = \x -> f (g x) |
| 2020-10-20 07:12:15 | <suzu_> | the stuff in the braces is a function that gets called with 8.9 |
| 2020-10-20 07:12:19 | <Echosolace> | f of g |
| 2020-10-20 07:12:23 | <merijn> | SO you get ((\x -> sum (replicate 5 x)) . max 6.7) 8.9 |
| 2020-10-20 07:13:07 | <merijn> | (\y -> (\x -> sum (replicate 5 x)) (max 6.7 y)) 8.9 |
| 2020-10-20 07:13:21 | <merijn> | Then we can simplify |
| 2020-10-20 07:13:26 | → | Plantain joins (~mdomin45@cpe-24-211-129-187.nc.res.rr.com) |
| 2020-10-20 07:13:43 | <merijn> | (\y -> sum (replicate 5 (max 6.7 y))) 8.9 |
| 2020-10-20 07:13:46 | <merijn> | And finally |
| 2020-10-20 07:13:59 | <merijn> | sum (replicate 5 (max 6.7 8.9)) |
| 2020-10-20 07:15:17 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-20 07:15:18 | <Echosolace> | Ok ok I think that helped... The stuff in the braces is a function that gets called with the outside parameter... got it. |
| 2020-10-20 07:15:31 | <merijn> | Although in practice you normally read "f . g . h" sorta like a pipeline where a values goes into 'h', it's result goes into 'g', and that result goes into 'f' (which, as you can see is exactly what happens in the elaborate version I wrote out |
| 2020-10-20 07:16:08 | <merijn> | Without constructing all the lambda's in your head, because that's a load of bookkeeping |
| 2020-10-20 07:16:15 | <ghoulguy> | I think it might help to rewrite (f.g.h) to (f.(g.h)) as an explicit step |
| 2020-10-20 07:17:03 | <merijn> | Possibly, but I had was too lazy to figure out the brace and (fortunately) "f.(g.h)" and "(f.g).h" are the same ;) |
| 2020-10-20 07:18:09 | <ghoulguy> | They end up being the same. I suppose it's convenient to collapse that all at once to \x->f(g(h x)) |
| 2020-10-20 07:18:48 | → | raichoo joins (~raichoo@213.240.178.58) |
| 2020-10-20 07:18:58 | <dminuoso> | Mmm, can a generic function to provide isomorphisms between arbitrary tuples (that is `f :: (S,T,U) -> ((S,T),U)`, `f :: (S,T,U) -> (S,(T,U))`, `f :: ((S,T),U) -> (S,T,U)` exist at all? |
| 2020-10-20 07:18:59 | <merijn> | Yeah, that's what my brain does, but that feels too much like "voodoo" for beginners, I think :) |
| 2020-10-20 07:19:19 | <merijn> | I like dumb, mechanical rewrite rules, because anyone get understand them and they work really well in Haskell :) |
| 2020-10-20 07:19:45 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2020-10-20 07:19:54 | × | lpsmith quits (~lpsmith@unaffiliated/lpsmith) (Quit: ZNC 1.6.5 - http://znc.in) |
| 2020-10-20 07:21:13 | × | Plantain quits (~mdomin45@cpe-24-211-129-187.nc.res.rr.com) (Ping timeout: 265 seconds) |
| 2020-10-20 07:21:37 | → | lpsmith joins (~lpsmith@unaffiliated/lpsmith) |
| 2020-10-20 07:22:15 | → | Plantain joins (~mdomin45@cpe-24-211-129-187.nc.res.rr.com) |
| 2020-10-20 07:23:33 | × | tzh quits (~tzh@2601:448:c500:5300::e74c) (Quit: zzz) |
| 2020-10-20 07:24:38 | → | SanchayanM joins (~Sanchayan@122.167.98.111) |
| 2020-10-20 07:25:27 | <Echosolace> | Ok this one has been doing my head in for a couple of days. It seems so similiar to the previous one - replicate 100 . product . map (*3) . zipWith max [1,2,3,4,5] $ [4,5,6,7,8] |
| 2020-10-20 07:25:49 | × | Sanchayan quits (~Sanchayan@106.200.207.22) (Ping timeout: 260 seconds) |
| 2020-10-20 07:25:54 | <Echosolace> | So a lengthy function is being called on 4,5..8 |
| 2020-10-20 07:25:57 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-20 07:26:10 | <Echosolace> | max determines that 4,5..8 is bigger. |
| 2020-10-20 07:26:20 | <Echosolace> | it's the zipWith that has me confused. |
| 2020-10-20 07:26:27 | <Echosolace> | There's nothing to zipWith... |
| 2020-10-20 07:26:42 | <merijn> | :t zipWith |
| 2020-10-20 07:26:43 | <lambdabot> | (a -> b -> c) -> [a] -> [b] -> [c] |
| 2020-10-20 07:26:53 | <Echosolace> | What... |
| 2020-10-20 07:26:57 | <Echosolace> | :t zipWith |
| 2020-10-20 07:26:57 | <opqdonut> | Echosolace: zipWith max [1,2,3,4] [4,5,6,7] ==> [max 1 4, max 2 5, max 3 6, max 4 7] |
| 2020-10-20 07:26:59 | <lambdabot> | (a -> b -> c) -> [a] -> [b] -> [c] |
| 2020-10-20 07:27:04 | <Echosolace> | Holy shit you can do that here? |
| 2020-10-20 07:27:11 | <merijn> | Yes? :p |
| 2020-10-20 07:27:17 | <merijn> | :t zipWith max |
| 2020-10-20 07:27:18 | <lambdabot> | Ord c => [c] -> [c] -> [c] |
| 2020-10-20 07:27:24 | → | thir joins (~thir@p200300f27f0b040039cda3b6fce8e5af.dip0.t-ipconnect.de) |
| 2020-10-20 07:27:26 | <Echosolace> | wtf you can type multiples? |
| 2020-10-20 07:27:36 | <Echosolace> | Yo. |
| 2020-10-20 07:27:39 | <merijn> | Echosolace: The flaw in your reasoning is that max isn't being applied to those lists |
| 2020-10-20 07:27:47 | <merijn> | zipWith is being applied to max |
| 2020-10-20 07:28:14 | <merijn> | And then "zipWith max" is applied first to one list and then "zipWith max [1,2,3,4]" is applied to the final list |
| 2020-10-20 07:29:02 | <merijn> | Echosolace: In general "foo bar baz quux" is parenthesised as "(((foo bar) baz) quux)" |
| 2020-10-20 07:29:16 | × | howdoi quits (uid224@gateway/web/irccloud.com/x-ejhfdvhwhujhpzoz) (Quit: Connection closed for inactivity) |
| 2020-10-20 07:29:26 | <merijn> | The exception is operator which are binary and *always* have lower precedence then function application |
| 2020-10-20 07:30:12 | <merijn> | So "replicate 100 . product . map (*3) . zipWith max [1,2,3,4,5]" is "(replicate 100) . product . (map (*3)) . (zipWith max [1,2,3,4,5])" |
| 2020-10-20 07:30:27 | → | avoandmayo joins (~textual@122-58-158-238-adsl.sparkbb.co.nz) |
| 2020-10-20 07:30:34 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-10-20 07:31:16 | <merijn> | > zipWith f [1,2,3,4] [5,6,7,8] |
| 2020-10-20 07:31:18 | <lambdabot> | error: |
| 2020-10-20 07:31:19 | <lambdabot> | • Ambiguous type variable ‘c0’ arising from a use of ‘show_M201622632345... |
All times are in UTC.