2025/03/03

Newest at the top

2025-03-03 23:25:22 +0100 <dolio> The 'problem' is some OO languages is that OO designs aren't good for certain things, but you can be forced to use the bad designs because better ones don't exist.
2025-03-03 23:25:07 +0100 <int-e> My perception is that this phenomenon is *old* and was never embraced by Haskell programmers except for doing crazy things often attributed to Oleg ;-).
2025-03-03 23:24:10 +0100 <int-e> "No, `class` is not an OO class. It's more like a Java interface." [...] "No, we do not do the Java EE thing where every single structure is first defined as an interface and then a type that implements it." [...] "I'm sorry to hear that your code is a mess but it's largely because you used the wrong ideas and abstractions for this language."
2025-03-03 23:24:06 +0100 <monochrom> People don't have to abuse OOP. And there are tons of ways to abuse FP too.
2025-03-03 23:23:41 +0100alfiee(~alfiee@user/alfiee) alfiee
2025-03-03 23:23:31 +0100 <monochrom> Look, even when I teach parametricity vs ad hoc, I come clean and note that although OOP formally allows ad hoc (as in, the "same" method on different types may have arbitrary differences), I note that I am scaremongering, real programmers don't normally do really arbitrary differences, actually the "different" behaviours are closely related and the differences reasonable and necessary. It's a spectrum with grey areas not just boolean black and white.
2025-03-03 23:23:28 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-03 23:22:57 +0100 <c_wraith> The only real abuse of type classes I've seen is when someone wants to share names for something that there is no way to use interchangeably.
2025-03-03 23:22:34 +0100 <haskellbridge> <Liamzee> or a possibility if someone learns OOP after coming from Haskell
2025-03-03 23:22:20 +0100 <dolio> Just assuming that type classes should be used like OOP.
2025-03-03 23:22:18 +0100 <jle`> usually when you write typeclass-polymorphic code you'd like to be able to reason with it. so with lawless typeclasses this is kind of hard. typeclasses have a lot of weight, being global and not hideable, so this can make things a bit tricky in practice
2025-03-03 23:22:17 +0100 <c_wraith> Orphan instances are actually supported better by tooling than they used to be. Haddock now lists orphan instances declared in a module
2025-03-03 23:21:47 +0100 <dolio> It sounds like something that commonly happens when someone learns Haskell after coming from OOP.
2025-03-03 23:21:24 +0100 <dolio> No.
2025-03-03 23:20:51 +0100 <haskellbridge> <Liamzee> but afaik that was in vogue a long time ago, wasn't it? then haskellers found out it was horrible and warned against it?
2025-03-03 23:20:31 +0100simplystuart(~simplystu@c-75-75-152-164.hsd1.pa.comcast.net)
2025-03-03 23:20:23 +0100 <monochrom> No programming language can ban all abuses.
2025-03-03 23:20:00 +0100simplystuart(~simplystu@c-75-75-152-164.hsd1.pa.comcast.net) (Ping timeout: 244 seconds)
2025-03-03 23:19:54 +0100 <haskellbridge> <Liamzee> i mean the only obviously bad thing that springs to mind is orphan instances
2025-03-03 23:19:45 +0100 <monochrom> All abuses are smelly. Well, much worse than smelly, it's criminal.
2025-03-03 23:19:08 +0100 <haskellbridge> <Liamzee> well, a different, more concrete question, what happened with the typeclass abuse thing, and why was it considered smelly? i.e, ad-hoc, lawless typeclasses intended to create OOP-style methods and functionality?
2025-03-03 23:17:58 +0100 <jle`> i guess you could formalize it by seeing it in terms of `forall a. NumDict a -> a`, (forall a. NumDict a -> [a] -> r) -> r, and `forall a. NumDict a`
2025-03-03 23:17:16 +0100 <jle`> so it's kind of neat when you CPS transform it you can see the Num/Fractional visually pop from negative to positive
2025-03-03 23:16:14 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 272 seconds)
2025-03-03 23:16:07 +0100 <jle`> yeah my two example types were the cps'd data N = forall a. Num a => N [a] and data F = forall a. Fractional a => F [a]
2025-03-03 23:15:21 +0100 <monochrom> OTOH I'll admit it's flipped with "data N' = N' (forall a. Num a => a)" and the analogous F'
2025-03-03 23:15:18 +0100 <jle`> yeah in the case i was talking about, F would be considered the subtype. only i use => F [a] instead of => F a
2025-03-03 23:15:01 +0100 <dolio> Existentials like that sort of have the class in positive position.
2025-03-03 23:14:45 +0100 <dolio> Yes.
2025-03-03 23:14:39 +0100 <monochrom> If you give me an F value, I can repackage it as an N value.
2025-03-03 23:14:19 +0100 <monochrom> Wait. So consider the existential types "data N = forall a. Num a => N a" and "data F = forall a. Fractional a => F a". Which one is a subtype of which? I think F is the subtype.
2025-03-03 23:13:06 +0100myxos(~myxos@syn-065-028-251-121.res.spectrum.com) myxokephale
2025-03-03 23:12:31 +0100 <jle`> it's still a bit weird to think of `Num` alone as positive but i guess there is no need to formalize that
2025-03-03 23:11:39 +0100 <dolio> Yeah.
2025-03-03 23:11:22 +0100 <jle`> if Num is negative in forall a. Num a => [a] -> r then it'd be positive in (forall a. Num a => [a] -> r) -> r
2025-03-03 23:11:18 +0100 <monochrom> s/You just/You know/
2025-03-03 23:11:13 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-03 23:10:41 +0100 <monochrom> It is pretty much why this world is such a mess.
2025-03-03 23:10:31 +0100 <monochrom> You just, trying to increase divisiveness and "controversy".
2025-03-03 23:10:06 +0100 <monochrom> Are you like a reporter for a politics newspaper? Because only they do this meme of "he said such and such, what do you think?"
2025-03-03 23:09:24 +0100 <monochrom> Sure. So ask that particular Haskeller.
2025-03-03 23:09:04 +0100 <haskellbridge> <Liamzee> because it was a stray comment by a Haskeller on /r/Haskell from up to 24 months ago
2025-03-03 23:08:45 +0100 <monochrom> Why do people ask you what other people think?
2025-03-03 23:08:34 +0100 <dolio> jle`: I think that's right, but there are to many negations for me to be really confident.
2025-03-03 23:08:09 +0100 <monochrom> Why do you not ask those people?
2025-03-03 23:08:06 +0100 <haskellbridge> <Liamzee> I'm working Rust right now, building a toy tetris game, and OOP's approach to data organization seems useful
2025-03-03 23:08:05 +0100 <jle`> usually it's because their oop professor was mean to them
2025-03-03 23:07:57 +0100 <monochrom> I don't know, because I am not one of them.
2025-03-03 23:07:23 +0100 <haskellbridge> <Liamzee> why do people complain that OOP rots the mind?
2025-03-03 23:06:44 +0100 <jle`> ...i think