2025/01/11

Newest at the top

2025-01-11 23:07:54 +0100 <geekosaur> it is very much a pattern in functional languages, and a very important one
2025-01-11 23:07:39 +0100 <geekosaur> I mean, `map`, pretty much everything in Foldable and Traversable, `interact` (which used to be the first thing you did in ghci), lots of things in Haskell use HOFs
2025-01-11 23:06:39 +0100 <geekosaur> it's very idiomatic in Haskell
2025-01-11 23:04:49 +0100 <c_wraith> Same as every other language, really.
2025-01-11 23:04:41 +0100 <c_wraith> Ah, that's much more common. But there's only one way out of that. Write code, ask for feedback, try out alternatives, develop your tastes.
2025-01-11 23:03:35 +0100 <ash3en> more like non-idiomatic, too complicated, verbose code
2025-01-11 23:03:16 +0100 <ash3en> maybe anti-pattern is not the best term
2025-01-11 23:02:32 +0100tnt2tnt1
2025-01-11 23:02:32 +0100tnt1(~Thunderbi@user/tnt1) (Ping timeout: 252 seconds)
2025-01-11 23:01:35 +0100tnt2(~Thunderbi@user/tnt1) tnt1
2025-01-11 23:01:12 +0100__monty__(~toonn@user/toonn) (Quit: leaving)
2025-01-11 23:00:54 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 276 seconds)
2025-01-11 22:56:10 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2025-01-11 22:54:34 +0100 <c_wraith> But it's rare that factoring something in terms of higher-order functions turns out to be a negative.
2025-01-11 22:53:58 +0100 <c_wraith> there are anti-patterns in Haskell. Things like the existential typeclass pattern, which laziness turns out to be a much simpler solution to in nearly every case.
2025-01-11 22:53:25 +0100rekahsoft(~rekahsoft@70.51.99.237) (Remote host closed the connection)
2025-01-11 22:46:27 +0100 <geekosaur> ("anti-pattern"?)
2025-01-11 22:45:23 +0100 <ash3en> i did use them in the past already, but I often am too afraid to use anti-patterns I am not aware of
2025-01-11 22:45:18 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
2025-01-11 22:43:13 +0100 <geekosaur> you'll get used to HOFs eventually 🙂
2025-01-11 22:42:03 +0100 <ash3en> geekosaur: yes, thank you. i will keep it like this for now and maybe put them into a single function later on : )
2025-01-11 22:41:32 +0100 <tomsmeding> I think I'm going to stay with a helper function. :)
2025-01-11 22:40:47 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2025-01-11 22:40:46 +0100 <geekosaur> ash3en, that works. I think you should also be able to write tokenizeNumber in terms of tokenizeString though
2025-01-11 22:40:41 +0100 <tomsmeding> the tail blows up but the zipWith doesn't evaluate the tail on []
2025-01-11 22:40:02 +0100 <tomsmeding> probie: I did not
2025-01-11 22:39:58 +0100 <tomsmeding> oh the zipWith saves you here, cute
2025-01-11 22:39:44 +0100 <lambdabot> True
2025-01-11 22:39:43 +0100 <tomsmeding> > (and . (zipWith (==) <*> tail)) []
2025-01-11 22:39:41 +0100 <probie> You didn't specify that you wanted it to be readable
2025-01-11 22:39:24 +0100 <tomsmeding> ah yes I can read that
2025-01-11 22:39:18 +0100tomsmeding. o O ( (<*>) = S = \f g x -> f x (g x) )
2025-01-11 22:38:28 +0100 <ash3en> tomsmeding: i am not aware of something off the top of my hat
2025-01-11 22:38:15 +0100 <lambdabot> Eq a => [a] -> Bool
2025-01-11 22:38:14 +0100 <probie> :t and . (zipWith (==) <*> tail)
2025-01-11 22:37:29 +0100 <ash3en> geekosaur: this is what i did now. does it look good to you? https://paste.tomsmeding.com/WfD77OU3
2025-01-11 22:32:39 +0100 <tomsmeding> i.e. "allEqual"
2025-01-11 22:32:30 +0100 <tomsmeding> is there a shorter way to write (\case [] -> True ; x:xs -> all (== x) xs)
2025-01-11 22:30:37 +0100supercode(~supercode@user/supercode) (Quit: Client closed)
2025-01-11 22:29:38 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds)
2025-01-11 22:29:29 +0100philopsos(~caecilius@user/philopsos) philopsos
2025-01-11 22:25:24 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2025-01-11 22:20:33 +0100 <ash3en> geekosaur: thank you!
2025-01-11 22:20:12 +0100 <ash3en> i think i get it now and i will try it out
2025-01-11 22:18:29 +0100 <ncf> monochrom: i'm still curious. how do you prove the obvious free theorem for forall a b. b -> ((a -> a) -> b) -> b ?
2025-01-11 22:17:58 +0100 <geekosaur> you can put any Haskell code inside the braces, and as long as the type of rtToken is available (since it's generating a normal Haskell source file and not using TH, it will be) you can use it
2025-01-11 22:17:58 +0100gmg(~user@user/gehmehgeh) gehmehgeh
2025-01-11 22:17:14 +0100gmg(~user@user/gehmehgeh) (Remote host closed the connection)
2025-01-11 22:16:47 +0100chexum(~quassel@gateway/tor-sasl/chexum) chexum
2025-01-11 22:16:38 +0100 <geekosaur> why wouldn't that work?