Logs: liberachat/#haskell
| 2021-06-09 11:11:00 | × | Cajun quits (~Cajun@ip98-163-211-112.no.no.cox.net) (Ping timeout: 250 seconds) |
| 2021-06-09 11:11:23 | × | maerwald quits (~maerwald@user/maerwald) (Quit: gone) |
| 2021-06-09 11:11:54 | → | maerwald joins (~maerwald@mail.hasufell.de) |
| 2021-06-09 11:14:03 | × | maerwald quits (~maerwald@mail.hasufell.de) (Changing host) |
| 2021-06-09 11:14:03 | → | maerwald joins (~maerwald@user/maerwald) |
| 2021-06-09 11:15:09 | → | ddellacosta joins (~ddellacos@89.46.62.17) |
| 2021-06-09 11:15:10 | → | sciencentistguy joins (~sciencent@hacksoc/ordinary-member) |
| 2021-06-09 11:15:23 | <gentauro> | 12:53 < maerwald> a single whitespace deciding on semantics is a dangerous path |
| 2021-06-09 11:15:25 | <gentauro> | howcome? |
| 2021-06-09 11:15:35 | <gentauro> | we do it for decimal numbers right? |
| 2021-06-09 11:15:48 | <maerwald> | gentauro: bugs |
| 2021-06-09 11:15:51 | <gentauro> | `10.24` is valid while `10 . 24` isn't |
| 2021-06-09 11:16:08 | <merijn> | hah |
| 2021-06-09 11:16:15 | <merijn> | that's what you think |
| 2021-06-09 11:16:18 | <merijn> | :t 10 . 24 |
| 2021-06-09 11:16:19 | <lambdabot> | (Num (b -> c), Num (a -> b)) => a -> c |
| 2021-06-09 11:16:39 | <gentauro> | maerwald: I understand it would be problematic for `backwards compatibility` reasons |
| 2021-06-09 11:16:44 | <gentauro> | merijn: :o |
| 2021-06-09 11:16:44 | <maerwald> | no, bugs |
| 2021-06-09 11:17:13 | <gentauro> | :t 1 2 7 |
| 2021-06-09 11:17:14 | <lambdabot> | (Num t1, Num t2, Num (t1 -> t2 -> t3)) => t3 |
| 2021-06-09 11:17:19 | <gentauro> | :| |
| 2021-06-09 11:17:21 | <gentauro> | what was that? |
| 2021-06-09 11:17:23 | <merijn> | maerwald: tbh, the biggest flaw in haskell is allowing operators without whitespace around them |
| 2021-06-09 11:17:23 | <gentauro> | I mean |
| 2021-06-09 11:17:27 | → | lortabac joins (~lortabac@2a01:e0a:541:b8f0:fef:c229:4466:542) |
| 2021-06-09 11:17:28 | <maerwald> | Compare with rusts misfeature of omitting `return` when the last line doesn't end with a `;` |
| 2021-06-09 11:17:35 | → | brandonh joins (~brandonh@151.46.91.125) |
| 2021-06-09 11:17:40 | <merijn> | gentauro: "1 :: Num a => a" there is no reason 'a' can't be a function |
| 2021-06-09 11:17:42 | <maerwald> | so now you have to BLINK every time at the end of a function body |
| 2021-06-09 11:17:52 | <maerwald> | to be sure you don't miss the damn `;` |
| 2021-06-09 11:17:55 | <maerwald> | or the lack thereof |
| 2021-06-09 11:17:56 | <merijn> | In fact, Num instances exist for functions |
| 2021-06-09 11:18:11 | <gentauro> | merijn: `λ> 1 . 2 <interactive>:2:1: error: ` |
| 2021-06-09 11:18:17 | <gentauro> | I get an error with my `ghci` |
| 2021-06-09 11:18:23 | <gentauro> | do I need to enable `stuff`? |
| 2021-06-09 11:18:30 | <merijn> | maerwald: If we had just specified Haskell from the start to make whitespace mandatory around operators 90% of these problems where nonexistent |
| 2021-06-09 11:18:37 | <merijn> | gentauro: It's an error because functions aren't printable |
| 2021-06-09 11:18:45 | <merijn> | > 1 . 2 -- this errors too |
| 2021-06-09 11:18:47 | <lambdabot> | error: |
| 2021-06-09 11:18:47 | <lambdabot> | • Could not deduce (Num (b0 -> c)) |
| 2021-06-09 11:18:47 | <lambdabot> | (maybe you haven't applied a function to enough arguments?) |
| 2021-06-09 11:18:57 | <merijn> | Because there's no Num instance for functions in scope |
| 2021-06-09 11:19:04 | <gentauro> | merijn: yeah, but my point was that: |
| 2021-06-09 11:19:05 | <gentauro> | > 1.2 |
| 2021-06-09 11:19:07 | <lambdabot> | 1.2 |
| 2021-06-09 11:19:11 | <gentauro> | is a decimal number |
| 2021-06-09 11:19:14 | <dminuoso> | This suggestion "maybe you haven't applied..." is particularly helpful here, merijn! |
| 2021-06-09 11:19:15 | <gentauro> | while |
| 2021-06-09 11:19:18 | <gentauro> | > 1 . 2 |
| 2021-06-09 11:19:20 | <lambdabot> | error: |
| 2021-06-09 11:19:20 | <lambdabot> | • Could not deduce (Num (b0 -> c)) |
| 2021-06-09 11:19:20 | <lambdabot> | (maybe you haven't applied a function to enough arguments?) |
| 2021-06-09 11:19:22 | <gentauro> | becomes a function |
| 2021-06-09 11:19:24 | <dminuoso> | (I know where it comes from, but it can be terribly deceiving) |
| 2021-06-09 11:19:30 | <merijn> | gentauro: "1 . 2" is valid Haskell expression that can compile just by importing a module |
| 2021-06-09 11:19:42 | × | ddellacosta quits (~ddellacos@89.46.62.17) (Ping timeout: 250 seconds) |
| 2021-06-09 11:19:44 | <maerwald> | gentauro: in sufficiently polymorphic code, both may compile |
| 2021-06-09 11:19:53 | <merijn> | gentauro: https://hackage.haskell.org/package/NumInstances |
| 2021-06-09 11:20:10 | <maerwald> | I've had impossible to guess bugs in lens code too, where you'd think it should have been an error |
| 2021-06-09 11:20:16 | <maerwald> | but it wasn't |
| 2021-06-09 11:20:33 | <merijn> | The other mistakes in Haskell was having unary - |
| 2021-06-09 11:21:22 | <merijn> | I swear, we could massively improve Haskell with a time machine, AMP proposal, and the sane plan for mandatory whitespace around operators and removing unary - |
| 2021-06-09 11:21:43 | <gentauro> | merijn: do you want to start over again? |
| 2021-06-09 11:21:45 | <gentauro> | xD |
| 2021-06-09 11:21:49 | <merijn> | Yes |
| 2021-06-09 11:21:51 | <maerwald> | merijn: nah, we're busy implementing type level features... no time for cleaning up the language |
| 2021-06-09 11:22:16 | <gentauro> | is this how Java become Java? :o |
| 2021-06-09 11:22:19 | <dminuoso> | % fix 1 |
| 2021-06-09 11:22:19 | <yahb> | dminuoso: ; <interactive>:3:1: error:; * No instance for (Num (() -> ())) arising from a use of `it'; (maybe you haven't applied a function to enough arguments?); * In the first argument of `print', namely `it'; In a stmt of an interactive GHCi command: print it |
| 2021-06-09 11:22:21 | <merijn> | maerwald: Can't really clean up some of these issues without Python2-to-3 scenarios, because old code might break |
| 2021-06-09 11:22:25 | <dminuoso> | % fix 1 |
| 2021-06-09 11:22:28 | <maerwald> | :: for kind signatures is confusing af for me |
| 2021-06-09 11:22:30 | <yahb> | dminuoso: [Timed out] |
| 2021-06-09 11:22:32 | <dminuoso> | Here. Compiles and runs just fine! |
| 2021-06-09 11:22:38 | <gentauro> | :t fix |
| 2021-06-09 11:22:39 | <lambdabot> | (a -> a) -> a |
| 2021-06-09 11:22:40 | <merijn> | maerwald: TypeInType is crazy nonsense, tbh |
| 2021-06-09 11:22:44 | <dminuoso> | If you ever want to fix your numbers, that's the way to go. |
| 2021-06-09 11:22:47 | <gentauro> | :t fix 1 |
| 2021-06-09 11:22:48 | <lambdabot> | Num (a -> a) => a |
| 2021-06-09 11:23:07 | <gentauro> | to `fix 1` equals infinite recursion? |
| 2021-06-09 11:23:15 | <merijn> | "maybe" |
| 2021-06-09 11:23:56 | <DigitalKiwi> | what is fix |
| 2021-06-09 11:24:06 | → | gehmehgeh joins (~user@user/gehmehgeh) |
| 2021-06-09 11:24:19 | <dminuoso> | DigitalKiwi: think of it as a tool to create anonymous loops |
| 2021-06-09 11:24:25 | <dminuoso> | or anonymous recursion, rather |
| 2021-06-09 11:24:56 | × | edwtjo quits (~edwtjo@user/edwtjo) (Quit: WeeChat 3.0) |
| 2021-06-09 11:25:02 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-06-09 11:25:11 | <dminuoso> | `ones = 1 : ones` requires a binding, so this is named recursion. Or you can just write `fix (1:)` |
| 2021-06-09 11:25:22 | <dminuoso> | (Ignoring tying-the-not here, which you should do) |
| 2021-06-09 11:25:29 | <merijn> | DigitalKiwi: fix is the most primitive distilled form of recursion |
| 2021-06-09 11:25:50 | <merijn> | DigitalKiwi: Any recursive function can be rewritten as fix + non-recursive function |
| 2021-06-09 11:26:02 | <dminuoso> | And any use of fix can be turned into just simple recursion. |
| 2021-06-09 11:26:19 | <merijn> | DigitalKiwi: See: https://gist.github.com/merijn/b86649a6aa21bd140803 |
| 2021-06-09 11:26:30 | <dminuoso> | One part where fix is particularly handy, is you have a data type and want to create mutually referencing fields |
| 2021-06-09 11:26:31 | <Taneb> | merijn: being pedantic, I'm not sure all instances of recursion can be written that way. In particular, polymorphic recursion fails |
| 2021-06-09 11:27:02 | <dminuoso> | You can just write `fix $ \d -> Data { f1 = [1,2,3]; f2 = [2,3,4]; f3 = f1 d <> f2 d }` for example |
| 2021-06-09 11:27:06 | <merijn> | Taneb: polymorphic recursion requires typeclasses or some such anyway, no? |
| 2021-06-09 11:27:15 | <Taneb> | No? Let me write something |
All times are in UTC.