2026/02/05

Newest at the top

2026-02-05 11:36:58 +0100__monty__(~toonn@user/toonn) (Quit: Lost terminal)
2026-02-05 11:32:27 +0100 <dutchie> so my example would be [Right "A", Left "ring", Right "is a structure with", Left "compatible addition and multiplication"]
2026-02-05 11:31:28 +0100 <dutchie> hmm, how could I encode a cloze deletion thing (i.e. fill-in-the-blanks "a [ring] is structure with [compatible addition and multiplication]") as a Haskell data type. first thought would be [Either String String] where Left is deleted text and Right is plain but that doesn't encode "at least one left and one right in some order"
2026-02-05 11:27:44 +0100trickard_(~trickard@cpe-61-98-47-163.wireline.com.au)
2026-02-05 11:27:38 +0100bggd_(~bgg@2a01:e0a:fd5:f510:45eb:593:20bc:aaf7)
2026-02-05 11:27:31 +0100trickard_(~trickard@cpe-61-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2026-02-05 11:19:08 +0100acidjnk(~acidjnk@p200300d6e700e57835d41376842fa308.dip0.t-ipconnect.de) acidjnk
2026-02-05 11:17:01 +0100xff0x(~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 246 seconds)
2026-02-05 11:17:01 +0100haritz(~hrtz@user/haritz) haritz
2026-02-05 11:17:01 +0100haritz(~hrtz@140.228.70.141) (Changing host)
2026-02-05 11:17:01 +0100haritz(~hrtz@140.228.70.141)
2026-02-05 11:15:05 +0100 <tomsmeding> fair. :P
2026-02-05 11:14:12 +0100 <int-e> tomsmeding: Sorry but I don't mind telling you things that you already know. :-P
2026-02-05 11:09:51 +0100 <tomsmeding> if you want a num instance for arrays, you can have the matlab experience
2026-02-05 11:09:33 +0100 <tomsmeding> I do not care one whit
2026-02-05 11:09:30 +0100 <tomsmeding> oh you mean for (+)
2026-02-05 11:09:08 +0100 <tomsmeding> int-e: you shouldn't tag me there, you should tag probie, I've thought about this plenty :p
2026-02-05 11:08:56 +0100 <int-e> (Smiley because I'm not sure that I'd heed that advice myself. Convenience is worth a lot of compromises...)
2026-02-05 11:07:59 +0100 <haskellbridge> <Liamzee> merijin: I don't mean replace num, I mean, turn num into a superclass a la the FAM change
2026-02-05 11:07:02 +0100 <int-e> tomsmeding: well you should only have square matrices of fixed size if you want a Num instance ;-)
2026-02-05 11:06:33 +0100 <merijn> Most proposed abstractions that are "more mathematically correct" tend to have really shit ergonomics for actual programming
2026-02-05 11:06:08 +0100 <probie> tomsmeding: Just only allow square matrices, and then have `fromInteger` set the diagonal
2026-02-05 11:06:03 +0100 <merijn> It's not happening
2026-02-05 11:05:45 +0100 <haskellbridge> <Liamzee> i wonder if we'll ever split num into ring subclasses
2026-02-05 11:05:08 +0100 <tomsmeding> probie: fair point, I guess
2026-02-05 11:04:56 +0100 <tomsmeding> int-e: I don't mind having to define abs and signum for matrices, but fromInteger is a pain in the behind :)
2026-02-05 11:04:34 +0100 <int-e> (it's a heap object; GC can move it)
2026-02-05 11:04:33 +0100 <haskellbridge> <Liamzee> just out of curiosity, if Haskell had a program paying UGs to do FOSS work, would you be donating?
2026-02-05 11:04:19 +0100akegalj(~akegalj@173-245.dsl.iskon.hr) akegalj
2026-02-05 11:02:37 +0100 <merijn> Leary: The reason IORef doesn't support ordering is that it's equality is based on memory address, which you can't use for ordering, since it might change
2026-02-05 11:02:36 +0100 <probie> It's not basic programming knowledge that `product (3,4) = 4` (alright, technically that's `Foldable` not `Traversable`, but close enough
2026-02-05 11:02:33 +0100 <int-e> (I don't usually mind fromInteger)
2026-02-05 11:01:58 +0100 <int-e> tomsmeding: all my rings are unital ;)
2026-02-05 11:01:47 +0100 <probie> tomsmeding: Who needs a sane instance when you can have a useful instance. I don't really think that it's any worse than `instance Traversable ((,) a)`.
2026-02-05 11:00:08 +0100mjrosenb(~mjrosenb@pool-71-190-143-170.nycmny.fios.verizon.net) (Remote host closed the connection)
2026-02-05 10:56:06 +0100 <tomsmeding> I imagined yes
2026-02-05 10:55:58 +0100 <int-e> tomsmeding: In that context I wouldn't care about abs and signum so I'd use abs = id and signum 0 = 0, signum _ = 1
2026-02-05 10:55:43 +0100 <tomsmeding> fromInteger also
2026-02-05 10:55:22 +0100 <tomsmeding> yes, yet another reason for Num to be nonsense
2026-02-05 10:55:11 +0100 <int-e> (if anybody ever makes a new Haskell derivative, `abs` and `signum` should be in their own class)
2026-02-05 10:55:03 +0100tomsmedingwas wondering why Complex doesn't have that instance, but it's magnitude computation in abs and signum
2026-02-05 10:53:41 +0100 <tomsmeding> I think there's a good argument to be made for _not_ having that instance. I know floats are a mess anyway, but at least it's considered basic programming knowledge that ordering on floats is a mess
2026-02-05 10:53:39 +0100 <int-e> Eh half of the time I feel like using it I end up copying Complex anyway, so I can have instance Num a => Num (Complex a)
2026-02-05 10:53:11 +0100trickard_(~trickard@cpe-61-98-47-163.wireline.com.au)
2026-02-05 10:52:17 +0100 <Leary> Yes, that's what would be derived, and what we should have.
2026-02-05 10:51:36 +0100 <probie> Personally, I suggest `instance (Ord a) => Ord (Complex a) where compare (a :+ b) (c :+ d) = compare (a,b) (c,d)`
2026-02-05 10:50:16 +0100 <Leary> Yeah, `Ord` is (or has become) a class for types that support /some/ decidable total order, however arbitrary. `Complex` poses no issue whatsoever, but e.g `IORef` might---it supports equality testing but not ordering.
2026-02-05 10:47:41 +0100 <lambdabot> (fromList [(NaN,3),(NaN,4)],False)
2026-02-05 10:47:40 +0100 <probie> > let { nan = 0/(0 :: Double); m = M.fromList [(nan, 3), (nan, 4)] } in (m, nan `M.member` m)
2026-02-05 10:45:27 +0100 <probie> We're already going to hell for misusing `Ord`