Logs: liberachat/#haskell
| 2025-12-01 15:32:46 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-12-01 15:33:00 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 2025-12-01 15:41:09 | <lucabtz> | https://paste.tomsmeding.com/HQQ4rMFc which indentation style do you prefer where? |
| 2025-12-01 15:41:16 | <lucabtz> | s/where/here |
| 2025-12-01 15:43:35 | <Leary> | They're both fugly. |
| 2025-12-01 15:43:50 | <lucabtz> | which do you use? |
| 2025-12-01 15:43:57 | <Leary> | How about: https://paste.tomsmeding.com/L3gjxpuS |
| 2025-12-01 15:45:23 | <lucabtz> | yeah i like that |
| 2025-12-01 15:45:29 | <lucabtz> | i need to pick up a style |
| 2025-12-01 15:47:54 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Ping timeout: 272 seconds) |
| 2025-12-01 15:47:54 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 272 seconds) |
| 2025-12-01 15:48:21 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 2025-12-01 15:49:53 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 2025-12-01 15:58:15 | × | euphores quits (~SASL_euph@user/euphores) (Quit: Leaving.) |
| 2025-12-01 15:59:34 | <kuribas> | Can I turn off these stupid stan warning in lsp? |
| 2025-12-01 15:59:58 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 246 seconds) |
| 2025-12-01 16:00:37 | <tomsmeding> | kuribas: you somehow have to set haskell.plugin.stan.globalOn = false in the configuration for HLS in your LSP client |
| 2025-12-01 16:00:46 | <tomsmeding> | how you do this differs per editor |
| 2025-12-01 16:01:19 | <haskellbridge> | <loonycyborg> Upgrade to GHC 9.12. It doesn't support that plugin :P |
| 2025-12-01 16:01:50 | → | traxex joins (traxex@user/traxex) |
| 2025-12-01 16:02:32 | × | __monty__ quits (~toonn@user/toonn) (Ping timeout: 240 seconds) |
| 2025-12-01 16:04:27 | → | larsivi joins (~larsivi@2a01:563:99:a400:1cc0:4d50:b9e7:edd1) |
| 2025-12-01 16:05:25 | <tomsmeding> | kuribas: https://haskell-language-server.readthedocs.io/en/stable/configuration.html |
| 2025-12-01 16:06:24 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-12-01 16:07:29 | <fgarcia> | i like the suggested one at the top. with that it helps me know what to expect from what was written near instantly |
| 2025-12-01 16:08:29 | <merijn> | awkward line wrapping and indentation is one of the main reasons I argue for never using let-in unless you have to :p |
| 2025-12-01 16:09:11 | <tomsmeding> | I'm confused, what's wrong with https://paste.tomsmeding.com/Zcd4imHd ? |
| 2025-12-01 16:09:54 | <merijn> | tomsmeding: That's only nice if you have 1 or 2 short bindings (but then you might as well do it on one line) |
| 2025-12-01 16:10:08 | <tomsmeding> | I dislike 'where' for not being an expression, so you can only put it at very specific places in the grammar |
| 2025-12-01 16:10:20 | <merijn> | tomsmeding: See, I consider that a feature :p |
| 2025-12-01 16:11:12 | → | Googulator76 joins (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 2025-12-01 16:11:26 | × | Googulator quits (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-12-01 16:11:51 | <fgarcia> | here i would expect that code to run inside main. most functions are able to be written with 'where'. to me it signals, even if not true, that it is expected stateful effects will happen when using 'let' |
| 2025-12-01 16:12:47 | <merijn> | I mean, you're almost never in a context where you can't use where, so I don't really see that as much of a limitation |
| 2025-12-01 16:14:04 | <tomsmeding> | merijn: ok I selected a very untyped function to not land in your "almost never" niche of "typed code with too many existentials" (which is 50% of my codebase): the printStats function here https://git.tomsmeding.com/chad-fast/tree/test-framework/Test/Framework.hs#n464 |
| 2025-12-01 16:14:22 | <tomsmeding> | yes, you can write this as a 'where', but then it's scoped over the whole functoin, not just this guard branch |
| 2025-12-01 16:18:40 | <lucabtz> | tomsmeding if there is a single binding your style looks good, but when you have multiple bindings with Leary's way it is simpler to align them |
| 2025-12-01 16:19:14 | <lucabtz> | however conveniently "let " is four characters and if you use 4 spaces indentation it is actually simple to align them your way too |
| 2025-12-01 16:19:26 | <tomsmeding> | on the contrary! The body of the let-binding is _not_ part of the list of bindings, so my opinion is that by aligning them, you're incorrectly suggesting a relationship that's not there |
| 2025-12-01 16:19:37 | <merijn> | tomsmeding: That's solved easily by using more where |
| 2025-12-01 16:19:59 | <merijn> | defining a name implementation per case, with their own where :p |
| 2025-12-01 16:20:17 | <merijn> | lucabtz: The problem is the in :p |
| 2025-12-01 16:20:21 | <tomsmeding> | hence my preference for using "in x", not "in x" or " in x" as some people do; I would accept "in x" if your argument is "I want the body to be indented at a multiple of 2 spaces" |
| 2025-12-01 16:20:50 | <tomsmeding> | merijn: more top-level functions you mean? |
| 2025-12-01 16:20:56 | <tomsmeding> | right, that's possible |
| 2025-12-01 16:21:15 | <lucabtz> | i didnt mean to align the body with the bindings, just the bidings need to be aligned |
| 2025-12-01 16:21:21 | <tomsmeding> | oh for sure |
| 2025-12-01 16:21:28 | <tomsmeding> | but 'let' already syntactically requires the bindings to be aligned |
| 2025-12-01 16:21:41 | <lucabtz> | if you have a new-line and indentation it works with any kind of indentation you have |
| 2025-12-01 16:21:42 | <merijn> | tomsmeding: No, not top level nested in the where of printStats |
| 2025-12-01 16:22:02 | <tomsmeding> | merijn: ah |
| 2025-12-01 16:22:02 | <merijn> | tomsmeding: Also, that example is trivially simplified by using do and it's let sugar, letting you skip the in entirely :p |
| 2025-12-01 16:22:12 | <tomsmeding> | and that is better how? :P |
| 2025-12-01 16:22:20 | <lucabtz> | if you put let x = y \n then in the new line the alignment works well only if you tab with four spaces |
| 2025-12-01 16:22:21 | <tomsmeding> | I disagree with "simplified" |
| 2025-12-01 16:22:26 | <tomsmeding> | it suggests a monad where there is none |
| 2025-12-01 16:22:37 | <tomsmeding> | lucabtz: yep, true |
| 2025-12-01 16:22:39 | <merijn> | tomsmeding: Your return type is IO? |
| 2025-12-01 16:22:46 | <tomsmeding> | oh |
| 2025-12-01 16:22:51 | <merijn> | #rekt |
| 2025-12-01 16:22:52 | <tomsmeding> | I guess, yes, in this case |
| 2025-12-01 16:22:54 | <tomsmeding> | :p |
| 2025-12-01 16:23:11 | <tomsmeding> | #rekt takes me back to high school |
| 2025-12-01 16:23:15 | <lucabtz> | so for one binding that option works well, but for multiple ones idk |
| 2025-12-01 16:23:35 | <merijn> | tomsmeding: tbh, I'd probably rewrite that to use `concat` to simplify line-wrapping the string too |
| 2025-12-01 16:23:35 | <tomsmeding> | lucabtz: what's your preferred indentation size? |
| 2025-12-01 16:23:52 | <tomsmeding> | yeah also possible |
| 2025-12-01 16:24:27 | <lucabtz> | it is 4 but i dont like that the style imposes 4 to be used |
| 2025-12-01 16:24:32 | <tomsmeding> | I see |
| 2025-12-01 16:24:55 | <tomsmeding> | I don't have that opinion but I respect you having it :p |
| 2025-12-01 16:25:12 | <lucabtz> | :p |
| 2025-12-01 16:25:29 | <tomsmeding> | another reason to not use my style: if you program with a proportional font |
| 2025-12-01 16:25:33 | <tomsmeding> | a colleague of mine does that |
| 2025-12-01 16:25:54 | <tomsmeding> | programming haskell with a proportional font is mostly feasible only if you only read your own code though :p |
| 2025-12-01 16:26:07 | <lucabtz> | though if you have only one binding i think your style is more readable |
| 2025-12-01 16:26:45 | <merijn> | Proportional font should be a crime |
| 2025-12-01 16:26:46 | → | machinedgod joins (~machinedg@d75-159-126-101.abhsia.telus.net) |
| 2025-12-01 16:27:00 | <lucabtz> | there is no [a] -> Int -> Maybe a safe list indexing in base? |
| 2025-12-01 16:27:14 | <tomsmeding> | no |
| 2025-12-01 16:27:22 | <lucabtz> | sad |
| 2025-12-01 16:27:32 | <lucabtz> | i found atZ using hoogle though |
| 2025-12-01 16:27:36 | <tomsmeding> | there is atMay here https://hackage.haskell.org/package/safe-0.3.21/docs/Safe.html |
| 2025-12-01 16:28:08 | <lucabtz> | https://hackage.haskell.org/package/errors-2.3.0/docs/Control-Error-Safe.html#v:atZ this looks more general |
| 2025-12-01 16:28:11 | <merijn> | lucabtz: "\l n -> listToMaybe $ drop n l" :p |
| 2025-12-01 16:28:16 | <Leary> | @hoogle [a] -> Int -> Maybe a |
| 2025-12-01 16:28:17 | <lambdabot> | Data.List (!?) :: [a] -> Int -> Maybe a |
| 2025-12-01 16:28:17 | <lambdabot> | GHC.List (!?) :: [a] -> Int -> Maybe a |
| 2025-12-01 16:28:17 | <lambdabot> | Safe atMay :: [a] -> Int -> Maybe a |
| 2025-12-01 16:28:37 | <tomsmeding> | oh? |
| 2025-12-01 16:28:42 | <tomsmeding> | % :i !? |
| 2025-12-01 16:28:42 | <yahb2> | <interactive>:1:1: error: [GHC-76037] Not in scope: ‘!?’ |
| 2025-12-01 16:28:42 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-12-01 16:28:45 | <tomsmeding> | % :i Data.List.!? |
| 2025-12-01 16:28:45 | <yahb2> | (GHC.Internal.List.!?) :: [a] -> Int -> Maybe a ; -- Defined in ‘GHC.Internal.List’ ; infixl 9 GHC.Internal.List.!? |
| 2025-12-01 16:28:47 | <tomsmeding> | TIL |
| 2025-12-01 16:28:56 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 2025-12-01 16:29:00 | <tomsmeding> | lucabtz: ^ |
| 2025-12-01 16:29:24 | <lucabtz> | cool |
| 2025-12-01 16:29:31 | <lucabtz> | hoogle didnt find it :( |
| 2025-12-01 16:29:46 | <tomsmeding> | https://hoogle.haskell.org/?hoogle=%5Ba%5D+-%3E+Int+-%3E+Maybe+a&scope=set%3Astackage |
All times are in UTC.