Logs: liberachat/#haskell
| 2021-05-21 10:31:03 | → | samhh joins (~samhh@90.252.103.244) |
| 2021-05-21 10:31:46 | × | nsilv quits (~nsilv@212.103.198.210) (Quit: WeeChat 3.0.1) |
| 2021-05-21 10:34:37 | <cjay> | nice |
| 2021-05-21 10:34:43 | × | Robin_Jadoul quits (~Robin_Jad@152.67.64.160) (Ping timeout: 260 seconds) |
| 2021-05-21 10:35:04 | juhp | is now known as petersen |
| 2021-05-21 10:38:04 | × | wonko quits (~wjc@user/wonko) (Quit: See You Space Cowboy..) |
| 2021-05-21 10:50:25 | → | wonko joins (~wjc@62.115.229.50) |
| 2021-05-21 10:51:00 | → | pcapriotti joins (pcapriotti@107.161.19.109) |
| 2021-05-21 10:51:14 | → | azeem74 joins (azeem@107.161.19.109) |
| 2021-05-21 10:51:21 | → | lambdadog joins (~user@136.55.166.148) |
| 2021-05-21 10:53:02 | <tomsmeding> | 🎉 |
| 2021-05-21 10:53:21 | × | azeem74 quits (azeem@107.161.19.109) (Client Quit) |
| 2021-05-21 10:54:30 | <Hecate> | hurray boxscape |
| 2021-05-21 10:54:37 | <boxscape> | :) |
| 2021-05-21 10:55:33 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds) |
| 2021-05-21 10:56:31 | × | pcapriotti quits (pcapriotti@107.161.19.109) (Quit: Connection closed) |
| 2021-05-21 10:57:00 | × | lambdadog quits (~user@136.55.166.148) (Quit: rcirc on GNU Emacs 28.0.50) |
| 2021-05-21 10:57:26 | <prop> | i was surprised at how quickly certain names were taken |
| 2021-05-21 10:57:30 | <prop> | i wanted to take my forename |
| 2021-05-21 10:57:32 | <prop> | but no chance |
| 2021-05-21 10:57:34 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-21 10:57:35 | <prop> | or middle name, no chance |
| 2021-05-21 10:57:43 | <Hecate> | I have a question that may sound like cargo culting, but would it be preferable to chain functions, or to call the next one inside the previous one? |
| 2021-05-21 10:57:44 | → | lambdadog joins (~user@136.55.166.148) |
| 2021-05-21 10:57:57 | <prop> | what do you mean hecate? |
| 2021-05-21 10:58:03 | <Hecate> | so, chaining functions |
| 2021-05-21 10:58:10 | <Hecate> | foo >== bar >== baz |
| 2021-05-21 10:58:35 | → | cfricke joins (~cfricke@user/cfricke) |
| 2021-05-21 10:58:41 | <boxscape> | as in (flip .)? |
| 2021-05-21 10:58:42 | <Hecate> | or foo x = bar x ; bar y = baz y |
| 2021-05-21 10:58:47 | <boxscape> | as in (flip (.))?* |
| 2021-05-21 10:58:51 | <Taneb> | Hecate: I'd say chaining functions here |
| 2021-05-21 10:59:00 | <Hecate> | (with a meaningful transformation of the argument inside each function, I'm not just inlining) |
| 2021-05-21 10:59:14 | <Hecate> | Taneb: ok :) That's what I thought |
| 2021-05-21 10:59:21 | <Taneb> | It means you can re-use them or test them individually easier |
| 2021-05-21 10:59:24 | → | Robin_Jadoul joins (~Robin_Jad@152.67.64.160) |
| 2021-05-21 10:59:26 | <Hecate> | yup |
| 2021-05-21 10:59:39 | <Hecate> | yeah I guess continuations have some legit usage at a lower-level |
| 2021-05-21 10:59:46 | <prop> | ooooh you mean to compose or write the call inside the function |
| 2021-05-21 11:00:12 | → | pcapriotti joins (pcapriotti@107.161.19.109) |
| 2021-05-21 11:00:21 | <Hecate> | yep |
| 2021-05-21 11:00:52 | × | pcapriotti quits (pcapriotti@107.161.19.109) (Client Quit) |
| 2021-05-21 11:01:05 | <prop> | i think sometimes for recursive functions at least, it is better to leave it with its fixed point argument |
| 2021-05-21 11:01:18 | <prop> | the reason being is that there are caching libraries that can use the fixed point argument if i remember correctly |
| 2021-05-21 11:01:31 | <prop> | but this depends on the situation ofc as to whether it matters |
| 2021-05-21 11:01:34 | × | wonko quits (~wjc@62.115.229.50) (Changing host) |
| 2021-05-21 11:01:34 | → | wonko joins (~wjc@user/wonko) |
| 2021-05-21 11:01:49 | <Hecate> | oki doki! |
| 2021-05-21 11:02:10 | <dminuoso> | Hecate: Personally Im quite fond of binding things in where clauses |
| 2021-05-21 11:02:26 | → | infinisil joins (~infinisil@mail.infinisil.com) |
| 2021-05-21 11:02:26 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds) |
| 2021-05-21 11:03:05 | <dminuoso> | Function composition is more useful when the composition itself has interesting structure, properties or reuse value |
| 2021-05-21 11:03:17 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-21 11:04:07 | <Hecate> | I'm not sure what you suggest applies in the question I was asking (composition/piping vs continuations) although I am indeed fond of where clauses myself |
| 2021-05-21 11:04:14 | <maerwald> | yeah, I also use $ more than ., unless . somehow feels right |
| 2021-05-21 11:04:29 | → | fendor joins (~fendor@178.115.59.240.wireless.dyn.drei.com) |
| 2021-05-21 11:04:43 | <boxscape> | don't tell ski |
| 2021-05-21 11:04:57 | <dminuoso> | Hecate: well, its a sort of in between. rather than writing `foo (bar (quux x))` I might write `f = foo special where special = bar (quux x)` |
| 2021-05-21 11:05:07 | → | fendor_ joins (~fendor@178.115.59.240.wireless.dyn.drei.com) |
| 2021-05-21 11:05:21 | <dminuoso> | Its hard to put into words, it largely depends on whether I want to put the focus and naming of things on the value itself, or the function. |
| 2021-05-21 11:05:31 | <Hecate> | dminuoso: yeah that's still composition :3 at a lower-leve/codegen I doubt it changes much |
| 2021-05-21 11:05:39 | × | knyppeldynan quits (~kristina@h-178-174-136-151.NA.cust.bahnhof.se) (Quit: Lost terminal) |
| 2021-05-21 11:05:52 | <boxscape> | Oh is that what the question was about? I had assumed it was about readability |
| 2021-05-21 11:06:04 | <dminuoso> | XY territory now. :) |
| 2021-05-21 11:06:26 | <prop> | ? am confused too ? |
| 2021-05-21 11:06:40 | <Hecate> | Taneb had a great point about testability in favour of chaining functions |
| 2021-05-21 11:07:02 | <Hecate> | so I'll stick with chaining |
| 2021-05-21 11:07:09 | <Hecate> | and will leave continuations to the compiler |
| 2021-05-21 11:07:14 | <dminuoso> | Im quite confused now. |
| 2021-05-21 11:07:25 | × | infinisil quits (~infinisil@mail.infinisil.com) (Quit: Configuring ZNC, sorry for the joins/quits!) |
| 2021-05-21 11:07:51 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds) |
| 2021-05-21 11:08:03 | → | infinisil joins (~infinisil@mail.infinisil.com) |
| 2021-05-21 11:08:25 | <dminuoso> | Hecate: What, to you, is the difference between "chaining functions" and "calling the next one inside the previous one"? |
| 2021-05-21 11:08:35 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-21 11:08:38 | <dminuoso> | Your pseudo code examples don't parse in my head |
| 2021-05-21 11:09:16 | → | knyppeldynan joins (~kristina@h-178-174-136-151.NA.cust.bahnhof.se) |
| 2021-05-21 11:10:02 | <Hecate> | at the code level, function composition is flat |
| 2021-05-21 11:10:13 | <prop> | personally i try to leave everything as point free as i can, but i think it is just a matter of taste really |
| 2021-05-21 11:10:25 | <prop> | it is what you like? |
| 2021-05-21 11:10:44 | <dminuoso> | "flat"? |
| 2021-05-21 11:10:45 | <Hecate> | whereas with calling the next one inside the previous one, you call one function in your call-site, and this function will call the rest of the functions for you |
| 2021-05-21 11:10:51 | <__monty__> | dminuoso: `f . g` vs `f x = something (g x)` |
| 2021-05-21 11:11:09 | <__monty__> | Where the first f would be `f = something`. |
| 2021-05-21 11:11:13 | <dminuoso> | __monty__: Yeah Im not sure, they sound.. confused.. |
| 2021-05-21 11:11:21 | <Hecate> | let me write a pastebin |
| 2021-05-21 11:13:03 | <Hecate> | https://paste.tomsmeding.com/S7s8xhmO dminuoso |
| 2021-05-21 11:13:28 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds) |
| 2021-05-21 11:13:37 | <dminuoso> | So first, those are not continuations. |
| 2021-05-21 11:13:41 | <Hecate> | ah, great |
| 2021-05-21 11:13:44 | <prop> | when should i use haskell.nix or cabal2nix? i'm annoyed at not having the right system dependencies like C libraries on different machines. also if i use nix can i run haskell binaries on other computers? |
| 2021-05-21 11:13:51 | <dminuoso> | Secondly, you seem to be mixing monad bind and function call here. |
| 2021-05-21 11:14:01 | <dminuoso> | So Im still not sure what you are asking about, exactly |
| 2021-05-21 11:14:02 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-21 11:14:11 | <dminuoso> | Function composition is (.), not (>>=) |
| 2021-05-21 11:14:21 | <dminuoso> | The monadic equivalent of function composition is (>=>/<=<) |
| 2021-05-21 11:14:24 | <Hecate> | prop: cabal2nix and haskell.nix are when you want nix to handle your haskell dependencies |
| 2021-05-21 11:14:42 | <Hecate> | prop: for system deps like C libraries, just write a shell.nix |
| 2021-05-21 11:14:54 | <Hecate> | prop: or use stack with nix support in the stack.yaml |
| 2021-05-21 11:15:03 | <dminuoso> | prop: Broadly, callCabal2Nix is closer to stack where you have curated versions, and haskell.nix gives you wider freedom in picking versions. |
| 2021-05-21 11:15:11 | <dminuoso> | (though haskell.nix has a lot of other tooling around it) |
All times are in UTC.