Logs: freenode/#haskell
| 2021-03-03 16:21:52 | × | vchlup_ quits (~vchlup@nat.brnet.cz) (Remote host closed the connection) |
| 2021-03-03 16:22:01 | <merijn> | robwebbjr: Right, but || shortcuts, so once the left side is True you don't have to evaluate the right side |
| 2021-03-03 16:22:15 | × | heatsink quits (~heatsink@2600:1700:bef1:5e10:dd5f:6f4f:a50:215d) (Ping timeout: 240 seconds) |
| 2021-03-03 16:22:18 | → | vchlup_ joins (~vchlup@nat.brnet.cz) |
| 2021-03-03 16:22:28 | <merijn> | robwebbjr: So once you evaluate "even 2 || ..." (where ... is the infinite recursive fold), you never bother computing ... |
| 2021-03-03 16:22:32 | <__minoru__shirae> | newbie76: resolver specification is project-specific, no? |
| 2021-03-03 16:22:37 | <merijn> | robwebbjr: You can simply return True immediately |
| 2021-03-03 16:22:44 | → | ericsagnes joins (~ericsagne@2405:6580:0:5100:42a8:8650:90d4:54bc) |
| 2021-03-03 16:23:00 | <merijn> | robwebbjr: Because "True || x = True" |
| 2021-03-03 16:23:18 | <merijn> | > True || undefined |
| 2021-03-03 16:23:20 | <lambdabot> | True |
| 2021-03-03 16:23:26 | <merijn> | > False || undefined |
| 2021-03-03 16:23:28 | <lambdabot> | *Exception: Prelude.undefined |
| 2021-03-03 16:23:34 | <__minoru__shirae> | newbie76: I mean, if I'm not mistaken, the resolver specification belongs to the project, not to the environment |
| 2021-03-03 16:23:43 | <merijn> | robwebbjr: (just imagine "undefined" being an infinite recursion instead) |
| 2021-03-03 16:24:12 | <newbie76> | I don't know, maybe. It's sort of complicated because stack init generates the stack.yaml file, right? and if I try to specify anything related to docker in that file before building (by echoing those lines in after running "stack init"), that doesn't work |
| 2021-03-03 16:25:14 | → | danso joins (~dan@2001:1970:52e7:d000:96b8:6dff:feb3:c009) |
| 2021-03-03 16:25:17 | <merijn> | Why would you run "stack init" in a docker container, that sounds very confused |
| 2021-03-03 16:25:43 | <robwebbjr> | merijn: OK, so 1) the b is irrelevant because short circuit is baked into (||) and 2) the fold stops because, well, short circuit is baked into the fold. |
| 2021-03-03 16:26:23 | <robwebbjr> | I meant baked into the (||) |
| 2021-03-03 16:26:29 | <merijn> | robwebbjr: Well, not so much baked into the fold as much as "the definition of foldr allows the short-circuit of it's argument function to affect the fold" |
| 2021-03-03 16:26:40 | → | Stanley00 joins (~stanley00@unaffiliated/stanley00) |
| 2021-03-03 16:26:49 | <newbie76> | I am very confused. Do you not need to run stack in a docker container? if so, why not? isn't it the build tool for your code? or are docker containers only used as sort of a place to put the folder with executables after you've built it? |
| 2021-03-03 16:26:50 | <merijn> | > foldr f z [1..5] |
| 2021-03-03 16:26:52 | <lambdabot> | f 1 (f 2 (f 3 (f 4 (f 5 z)))) |
| 2021-03-03 16:27:21 | <__minoru__shirae> | short-circuiting works only with foldr |
| 2021-03-03 16:27:25 | → | chenshen joins (~chenshen@2620:10d:c090:400::5:9f47) |
| 2021-03-03 16:27:27 | <__minoru__shirae> | iirc |
| 2021-03-03 16:27:29 | <robwebbjr> | Yes, sorry about that. I get it. Thank you so much for your help! |
| 2021-03-03 16:27:33 | <merijn> | newbie76: stack init generates an initial scaffold for a project. You are supposed to have a manually created stack.yaml that defines your project and then use that to build |
| 2021-03-03 16:27:40 | <merijn> | robwebbjr: For contrast, compare: |
| 2021-03-03 16:27:43 | → | ep1ctetus joins (~epictetus@ip72-194-215-136.sb.sd.cox.net) |
| 2021-03-03 16:27:46 | <merijn> | > foldl f z [1..5] |
| 2021-03-03 16:27:48 | <lambdabot> | f (f (f (f (f z 1) 2) 3) 4) 5 |
| 2021-03-03 16:28:36 | → | ADG1089__ joins (~aditya@122.163.250.138) |
| 2021-03-03 16:28:40 | <merijn> | Note how you need to evaluate all recursive calls (or reach the end of the list) to evaluate anything |
| 2021-03-03 16:28:41 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:dd5f:6f4f:a50:215d) |
| 2021-03-03 16:28:49 | × | fendor quits (~fendor@91.141.0.81.wireless.dyn.drei.com) (Ping timeout: 245 seconds) |
| 2021-03-03 16:28:56 | <merijn> | That's why foldl can't short circuit (and thus not do anything with an infinite list) |
| 2021-03-03 16:28:57 | <cheater> | this is the 10th foldl tutorial today in this channel |
| 2021-03-03 16:29:21 | <merijn> | cheater: That's down from the 50 per day when I started years ago ;) |
| 2021-03-03 16:29:30 | <robwebbjr> | _minoru_shirae: Oh, short circuit only works with foldr? That's good to know! |
| 2021-03-03 16:29:33 | <cheater> | merijn: the day hasn't even started. give it time |
| 2021-03-03 16:29:36 | → | sagax joins (~sagax_nb@213.138.71.146) |
| 2021-03-03 16:29:41 | <merijn> | cheater: It's 17.30 here :p |
| 2021-03-03 16:29:42 | × | emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer) |
| 2021-03-03 16:30:04 | <newbie76> | okay, "stack init" is really only used once at the beginning of creating a project, after "stack new"? |
| 2021-03-03 16:30:05 | → | emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) |
| 2021-03-03 16:30:40 | <merijn> | I don't use stack, but I'm willing to bet you 20 bucks on "yes" :p |
| 2021-03-03 16:30:56 | × | Stanley00 quits (~stanley00@unaffiliated/stanley00) (Ping timeout: 240 seconds) |
| 2021-03-03 16:31:01 | <merijn> | cheater: It's easy to forget how hard and confusing folds are at first! |
| 2021-03-03 16:31:42 | <robwebbjr> | Thanks everyone. The Haskell Book should mention that foldr short circuits, it would probably save many newbies much confusion! |
| 2021-03-03 16:31:42 | <merijn> | robwebbjr: If you wanna get sidetracked pondering folds for some time, here's a good link: https://tsouanas.org/teaching/fun/2019.2/doc/hutton-fold.pdf :) |
| 2021-03-03 16:32:01 | <oafs> | oh cool, I didn't know lambdabot could "expand" functions like that |
| 2021-03-03 16:32:13 | <oafs> | does it do that if you just use an unbound variable in a call? |
| 2021-03-03 16:32:20 | <newbie76> | okay, thanks lol. at least now I'm getting a new error: "Could not pull Docker image: fpco/stack-build:lts-9. There may not be an image on the registry for your resolver's LTS version in your configuration file." |
| 2021-03-03 16:32:23 | <merijn> | oafs: It's actually using |
| 2021-03-03 16:32:27 | <merijn> | @hackage simple-reflect |
| 2021-03-03 16:32:27 | <lambdabot> | https://hackage.haskell.org/package/simple-reflect |
| 2021-03-03 16:32:29 | <oafs> | > x : y : [] |
| 2021-03-03 16:32:30 | <merijn> | Which defines |
| 2021-03-03 16:32:31 | <lambdabot> | [x,y] |
| 2021-03-03 16:32:33 | <merijn> | :t f |
| 2021-03-03 16:32:35 | <lambdabot> | FromExpr a => a |
| 2021-03-03 16:32:37 | <merijn> | :t x |
| 2021-03-03 16:32:38 | <lambdabot> | Expr |
| 2021-03-03 16:32:39 | <merijn> | : y |
| 2021-03-03 16:32:57 | <merijn> | oafs: So the hack is that 'f', 'z', 'x' and 'y' aren't unbound ;) |
| 2021-03-03 16:32:58 | <robwebbjr> | merijn Thanks for the link |
| 2021-03-03 16:33:39 | <oafs> | well that's interesting lol |
| 2021-03-03 16:33:58 | <merijn> | oafs: That package is arcane magic, it's fun to study :) |
| 2021-03-03 16:34:51 | <boxscape> | > foldr (⊕) z [a,b,c,d] |
| 2021-03-03 16:34:54 | <lambdabot> | a ⊕ (b ⊕ (c ⊕ (d ⊕ z))) |
| 2021-03-03 16:35:06 | <boxscape> | > foldl (⊕) z [a,b,c,d] |
| 2021-03-03 16:35:08 | <lambdabot> | (((z ⊕ a) ⊕ b) ⊕ c) ⊕ d |
| 2021-03-03 16:35:10 | <boxscape> | nice |
| 2021-03-03 16:35:14 | <oafs> | nifty |
| 2021-03-03 16:35:27 | <merijn> | Same as this lambdabot specific hack |
| 2021-03-03 16:35:31 | <merijn> | @src asAppliedTo |
| 2021-03-03 16:35:31 | <lambdabot> | f `asAppliedTo` a = f where _ = f a |
| 2021-03-03 16:35:31 | <lambdabot> | infixl 0 `asAppliedTo` |
| 2021-03-03 16:35:47 | × | ADG1089__ quits (~aditya@122.163.250.138) (Remote host closed the connection) |
| 2021-03-03 16:35:49 | <cheater> | merijn: yes, i too get lost in folds sometimes. |
| 2021-03-03 16:35:50 | <merijn> | :t forM_ |
| 2021-03-03 16:35:52 | <lambdabot> | (Foldable t, Monad m) => t a -> (a -> m b) -> m () |
| 2021-03-03 16:35:59 | <merijn> | :t forM_ `asAppliedTo` [] |
| 2021-03-03 16:36:01 | <lambdabot> | Monad m => [a] -> (a -> m b) -> m () |
| 2021-03-03 16:36:02 | <boxscape> | % :t +d forM_ |
| 2021-03-03 16:36:03 | <yahb> | boxscape: Monad m => [a] -> (a -> m b) -> m () |
| 2021-03-03 16:36:14 | × | chenshen quits (~chenshen@2620:10d:c090:400::5:9f47) (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
| 2021-03-03 16:36:47 | → | fendor joins (~fendor@91.141.0.81.wireless.dyn.drei.com) |
| 2021-03-03 16:37:19 | × | hiroaki_ quits (~hiroaki@2a02:8108:8c40:2bb8:4198:736b:7066:258b) (Ping timeout: 272 seconds) |
| 2021-03-03 16:38:15 | <Philonous> | merijn, No, »stack new« creates an initial scaffold, »stack init« tries to guess a stack configuration for an existing cabal project |
| 2021-03-03 16:38:37 | → | chenshen joins (~chenshen@2620:10d:c090:400::5:9f47) |
| 2021-03-03 16:38:51 | <ezzieyguywuf> | can I install QuickCheck-2.14.2 with old-random AND new random? http://dpaste.com/4ZHD6SSFU |
| 2021-03-03 16:38:58 | <Philonous> | Oh, sorry, you're still right, you wouldn't want to run that in your build system anyway |
| 2021-03-03 16:38:58 | <ezzieyguywuf> | or is this not the intent of the flag? |
| 2021-03-03 16:39:05 | <edwardk> | i'm going to let a bunch of domains go in a few months. they've been lurking on my godaddy account. if anybody here (especially someone I know, and especially if you'll put them to use) wants homotopygroup.com, coinductive.com or monoidal.io let me know. (there are a bunch of others, but those are the ones that sounded haskelly) |
| 2021-03-03 16:39:07 | <merijn> | Philonous: Well, that doesn't invalidate my statement that you certainly *don't* wanna run it in your build pipeline ;) |
| 2021-03-03 16:40:10 | → | ADG1089__ joins (~aditya@122.163.250.138) |
All times are in UTC.