2025/12/01

Newest at the top

2025-12-01 17:28:17 +0100 <lambdabot> Safe atMay :: [a] -> Int -> Maybe a
2025-12-01 17:28:17 +0100 <lambdabot> GHC.List (!?) :: [a] -> Int -> Maybe a
2025-12-01 17:28:17 +0100 <lambdabot> Data.List (!?) :: [a] -> Int -> Maybe a
2025-12-01 17:28:16 +0100 <Leary> @hoogle [a] -> Int -> Maybe a
2025-12-01 17:28:11 +0100 <merijn> lucabtz: "\l n -> listToMaybe $ drop n l" :p
2025-12-01 17:28:08 +0100 <lucabtz> https://hackage.haskell.org/package/errors-2.3.0/docs/Control-Error-Safe.html#v:atZ this looks more general
2025-12-01 17:27:36 +0100 <tomsmeding> there is atMay here https://hackage.haskell.org/package/safe-0.3.21/docs/Safe.html
2025-12-01 17:27:32 +0100 <lucabtz> i found atZ using hoogle though
2025-12-01 17:27:22 +0100 <lucabtz> sad
2025-12-01 17:27:14 +0100 <tomsmeding> no
2025-12-01 17:27:00 +0100 <lucabtz> there is no [a] -> Int -> Maybe a safe list indexing in base?
2025-12-01 17:26:46 +0100machinedgod(~machinedg@d75-159-126-101.abhsia.telus.net) machinedgod
2025-12-01 17:26:45 +0100 <merijn> Proportional font should be a crime
2025-12-01 17:26:07 +0100 <lucabtz> though if you have only one binding i think your style is more readable
2025-12-01 17:25:54 +0100 <tomsmeding> programming haskell with a proportional font is mostly feasible only if you only read your own code though :p
2025-12-01 17:25:33 +0100 <tomsmeding> a colleague of mine does that
2025-12-01 17:25:29 +0100 <tomsmeding> another reason to not use my style: if you program with a proportional font
2025-12-01 17:25:12 +0100 <lucabtz> :p
2025-12-01 17:24:55 +0100 <tomsmeding> I don't have that opinion but I respect you having it :p
2025-12-01 17:24:32 +0100 <tomsmeding> I see
2025-12-01 17:24:27 +0100 <lucabtz> it is 4 but i dont like that the style imposes 4 to be used
2025-12-01 17:23:52 +0100 <tomsmeding> yeah also possible
2025-12-01 17:23:35 +0100 <tomsmeding> lucabtz: what's your preferred indentation size?
2025-12-01 17:23:35 +0100 <merijn> tomsmeding: tbh, I'd probably rewrite that to use `concat` to simplify line-wrapping the string too
2025-12-01 17:23:15 +0100 <lucabtz> so for one binding that option works well, but for multiple ones idk
2025-12-01 17:23:11 +0100 <tomsmeding> #rekt takes me back to high school
2025-12-01 17:22:54 +0100 <tomsmeding> :p
2025-12-01 17:22:52 +0100 <tomsmeding> I guess, yes, in this case
2025-12-01 17:22:51 +0100 <merijn> #rekt
2025-12-01 17:22:46 +0100 <tomsmeding> oh
2025-12-01 17:22:39 +0100 <merijn> tomsmeding: Your return type is IO?
2025-12-01 17:22:37 +0100 <tomsmeding> lucabtz: yep, true
2025-12-01 17:22:26 +0100 <tomsmeding> it suggests a monad where there is none
2025-12-01 17:22:21 +0100 <tomsmeding> I disagree with "simplified"
2025-12-01 17:22:20 +0100 <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 17:22:12 +0100 <tomsmeding> and that is better how? :P
2025-12-01 17:22:02 +0100 <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 17:22:02 +0100 <tomsmeding> merijn: ah
2025-12-01 17:21:42 +0100 <merijn> tomsmeding: No, not top level nested in the where of printStats
2025-12-01 17:21:41 +0100 <lucabtz> if you have a new-line and indentation it works with any kind of indentation you have
2025-12-01 17:21:28 +0100 <tomsmeding> but 'let' already syntactically requires the bindings to be aligned
2025-12-01 17:21:21 +0100 <tomsmeding> oh for sure
2025-12-01 17:21:15 +0100 <lucabtz> i didnt mean to align the body with the bindings, just the bidings need to be aligned
2025-12-01 17:20:56 +0100 <tomsmeding> right, that's possible
2025-12-01 17:20:50 +0100 <tomsmeding> merijn: more top-level functions you mean?
2025-12-01 17:20:21 +0100 <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 17:20:17 +0100 <merijn> lucabtz: The problem is the in :p
2025-12-01 17:19:59 +0100 <merijn> defining a name implementation per case, with their own where :p
2025-12-01 17:19:37 +0100 <merijn> tomsmeding: That's solved easily by using more where
2025-12-01 17:19:26 +0100 <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