Logs: liberachat/#haskell
| 2025-12-01 00:20:35 | <haskellbridge> | <zoil> well, the image combines both the error and the sourcecode neatly... |
| 2025-12-01 00:21:44 | <geekosaur> | both the pastebin I suggested and gist (and some others) let you include multiple "files"/pastes |
| 2025-12-01 00:22:31 | <jackdk> | The pastebin makes it easier for people to noodle around with the code if they have to, run their screenreader over it (if required), copy it into their editor (where they have proper syntax highlighting) etc. It's just so much easier to work with than the screenshot tool, though I appreciate the effort in slicing out the relevant parts of the error and the source. |
| 2025-12-01 00:22:59 | <haskellbridge> | <zoil> ok |
| 2025-12-01 00:23:13 | <haskellbridge> | <zoil> well the paste isnt going to compile, but its readable |
| 2025-12-01 00:24:00 | <haskellbridge> | <zoil> tldr: if you define an instance recursively it isnt "exhaustive" in some sense, and it asks for the constraint to be supplied and the deriving statement doesnt work |
| 2025-12-01 00:24:25 | <haskellbridge> | <zoil> it needs the standalone deriving statement so there is a place to put the constraint. but then this constraint appears everywhere |
| 2025-12-01 00:24:37 | <haskellbridge> | <zoil> iv run into this a bunch of times when having to write recursive instances |
| 2025-12-01 00:24:48 | <haskellbridge> | <zoil> like, FromNat n appears everywhere |
| 2025-12-01 00:24:53 | <haskellbridge> | <zoil> or like, Length xs |
| 2025-12-01 00:26:12 | <haskellbridge> | <zoil> i need to assert to the compiler "this instance is complete!" |
| 2025-12-01 00:27:25 | <haskellbridge> | <zoil> idk some kind of "exhaustiveness checks for matching cases of sum datatypes in instance declarations" proposal or smt |
| 2025-12-01 00:28:20 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-12-01 00:28:31 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 2025-12-01 00:28:56 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 2025-12-01 00:30:02 | <haskellbridge> | <zoil> but to do so, this is the placement of the constraint! i mean, thats literally how to convey that the instance is required to exist. i just dont know how to assert that it _does_ exist. which is normally automatic, but this exhaustiveness business seems to induce |
| 2025-12-01 00:30:41 | <haskellbridge> | <zoil> any ideas? |
| 2025-12-01 00:31:05 | <monochrom> | "It wouldn't compile anyway" is not a good reason to post a screenshot instead of actually downloading editable code. |
| 2025-12-01 00:31:29 | <monochrom> | Because, with luck, someone could have made an easy change and make it compilable. |
| 2025-12-01 00:31:57 | <haskellbridge> | <zoil> im not sure what your asking of me? |
| 2025-12-01 00:32:52 | <haskellbridge> | <zoil> im kind of in the middle of something, otherwise id happily write up a least sufficient example |
| 2025-12-01 00:32:57 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 2025-12-01 00:33:21 | <haskellbridge> | <zoil> i figured people would be able to read the paste or image and that would suffice, i dont have time to make a full proposal |
| 2025-12-01 00:33:28 | <haskellbridge> | <zoil> is it a known issue? |
| 2025-12-01 00:33:41 | <haskellbridge> | <zoil> im sure people have encountered this before... |
| 2025-12-01 00:34:22 | <jreicher> | hololeap: Maybe https://en.wikipedia.org/wiki/Witness_(mathematics) will interest you? |
| 2025-12-01 00:35:49 | <haskellbridge> | <zoil> you would have to say exactly in what way |
| 2025-12-01 00:36:04 | <haskellbridge> | <zoil> i cant see from skimming how its relavent |
| 2025-12-01 00:36:22 | <haskellbridge> | <zoil> there is an Exists symbol and my eyes kind of bounce off it... |
| 2025-12-01 00:36:31 | × | X-Scale quits (~ARM@6.67.114.89.rev.vodafone.pt) (Ping timeout: 240 seconds) |
| 2025-12-01 00:36:40 | <haskellbridge> | <zoil> we had all kinds of discussions back in the day about existential quantification |
| 2025-12-01 00:36:49 | <haskellbridge> | <iqubic (she/her)> Well, if someone wants to take your code and try it out on their own and make changes to it, their first step would be "type it all out in their own text editor". However, the code already exists on your computer, so you can share the textual version on https://paste.tomsmeding.com easily by copy and paste. Then all we'd have to do is copy and paste it into our text editor and then we could easily make changes to it. |
| 2025-12-01 00:36:54 | <haskellbridge> | <zoil> theres even an extension no? |
| 2025-12-01 00:37:25 | <iqubic> | Also, yes, I do have this channel open in two different forms. Emacs and Firefox. |
| 2025-12-01 00:37:27 | <haskellbridge> | <zoil> iqubic: again, im not sure what your asking. iv stated i dont have the wherewithall to write up a proposal |
| 2025-12-01 00:37:29 | <EvanR> | you're all spoiled now a days. We should return to a time when men were men and copied code char by char out of a magazine |
| 2025-12-01 00:37:54 | <haskellbridge> | <zoil> im sure the image and paste are sufficient, im not sure whats the problem. |
| 2025-12-01 00:38:06 | <glguy> | zoil: You can just merge the two instances into one, can't you? |
| 2025-12-01 00:38:18 | <monochrom> | True, I was one of those readers of those magazines, and typed in the code myself. |
| 2025-12-01 00:38:25 | <haskellbridge> | <zoil> glguy: i think not |
| 2025-12-01 00:38:28 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 2025-12-01 00:38:37 | <haskellbridge> | <zoil> it requires both to match |
| 2025-12-01 00:38:41 | <glguy> | zoil: then that's why the compiler can't do it fo ryou |
| 2025-12-01 00:39:06 | <haskellbridge> | <zoil> but i want to say to it "i have done the exhaustiveness check, its all there, dont worry" |
| 2025-12-01 00:39:14 | <glguy> | that won't help it know which one to use |
| 2025-12-01 00:39:15 | <monochrom> | The magazine publisher also offered to sell floppy diskettes containing the code. I was able to buy some of that when I had some petty cash. |
| 2025-12-01 00:39:20 | <iqubic> | The compiler is not smart. It just does simple rewriting and instance creation. |
| 2025-12-01 00:39:34 | <EvanR> | monochrom, smh... you BOUGHT the code? smh |
| 2025-12-01 00:39:42 | <iqubic> | If you can't tell which instance to choose, then how the heck do you expect the compiler to do it for you? |
| 2025-12-01 00:39:48 | <monochrom> | copies! just copies. |
| 2025-12-01 00:39:58 | <EvanR> | that's like buying food |
| 2025-12-01 00:40:18 | <monochrom> | It was also the latter days when those programs became very long. |
| 2025-12-01 00:40:18 | <haskellbridge> | <zoil> wait wait, im trying to seperate the people talking about floppy disks from the people staying ontopic, i think it might be a mod, im not sure. |
| 2025-12-01 00:40:26 | <haskellbridge> | <zoil> THANKS! |
| 2025-12-01 00:40:38 | <EvanR> | yes I had this flight simulator program which was several pages |
| 2025-12-01 00:40:43 | <EvanR> | cool program |
| 2025-12-01 00:40:46 | <haskellbridge> | <zoil> _facepalm_ |
| 2025-12-01 00:40:47 | <glguy> | zoil: you can probably combine the Show case just fine, it's the Read one that you'll struggle with |
| 2025-12-01 00:41:00 | <haskellbridge> | <zoil> how so? |
| 2025-12-01 00:41:20 | <haskellbridge> | <zoil> it needs to diferentiate between if its the basecase (S Z) or the recursive case (S (S n)) |
| 2025-12-01 00:41:28 | <glguy> | because show gets an argument that let's it learn what the type is |
| 2025-12-01 00:41:37 | <haskellbridge> | <zoil> (im going to start counting from one for nonempty containers in future versions...) |
| 2025-12-01 00:42:08 | <haskellbridge> | <zoil> it throws an error for both the read and show case |
| 2025-12-01 00:42:39 | <haskellbridge> | <zoil> also, the type ambiguity doesnt inhibit the read instance |
| 2025-12-01 00:43:35 | <haskellbridge> | <zoil> i would think basically, that if i gave it a newtype, that this would serve as such an assertion |
| 2025-12-01 00:43:42 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-12-01 00:43:46 | <haskellbridge> | <zoil> but it just looks underneath and still demands the underlying constraint |
| 2025-12-01 00:44:08 | <Leary> | zoil: This kind of exhaustiveness doesn't exist at the type level in GHC for the same reason we don't have "eta-rules" <https://gitlab.haskell.org/ghc/ghc/-/issues/7259>; it isn't sound. You want to say that `xs :: NonEmpty _` implies `xs ~ Cons _ _` or `Last _`, but that isn't true until you successfully pattern match on `Transfers xs`. |
| 2025-12-01 00:44:53 | <haskellbridge> | <zoil> thanks! i thought it would be a known issue |
| 2025-12-01 00:45:44 | <Leary> | There is a kind-of workaround for `Read`-like cases by taking a singleton as a constraint and matching on it, but then you have to supply that singleton constraint everywhere instead. |
| 2025-12-01 00:46:11 | <glguy> | zoil: merging Show would be like: https://paste.tomsmeding.com/UEfrQUiN |
| 2025-12-01 00:47:07 | <haskellbridge> | <zoil> oh wow! thats awesome, i never thought thats what you meant when you said it could go in one instance |
| 2025-12-01 00:47:14 | <haskellbridge> | <zoil> so you just put a type family for the constraint |
| 2025-12-01 00:47:15 | <haskellbridge> | <zoil> thats cool |
| 2025-12-01 00:47:23 | <haskellbridge> | <zoil> and your saying thats not possible for the readd instance? |
| 2025-12-01 00:47:34 | <glguy> | right |
| 2025-12-01 00:47:58 | <haskellbridge> | <zoil> forgive me, i dont imidiately see the difference |
| 2025-12-01 00:48:06 | <glguy> | One has a https://en.wikipedia.org/wiki/Witness_(mathematics) |
| 2025-12-01 00:48:15 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 2025-12-01 00:48:25 | <glguy> | the argument to show witnesses what type show is being instantiated at |
| 2025-12-01 00:48:32 | <haskellbridge> | <zoil> but i can supply a type application? |
| 2025-12-01 00:48:48 | <glguy> | No, that's not enough |
| 2025-12-01 00:48:57 | <haskellbridge> | <zoil> read @(Cons Int (Last Bool)) |
| 2025-12-01 00:49:16 | <glguy> | That that's not usable information in the implementation of read itself on this type |
| 2025-12-01 00:49:26 | <haskellbridge> | <zoil> * @(HList (Cons |
| 2025-12-01 00:49:54 | <glguy> | the argument to show is a value that's going to exist at runtime |
| 2025-12-01 00:50:33 | <haskellbridge> | <zoil> well i could provide a proxy... |
| 2025-12-01 00:51:12 | <haskellbridge> | <zoil> btw, does your show instance pick up the requirement for the constraint to be specified each time, like if it was recursive in different classes? |
| 2025-12-01 00:51:18 | <haskellbridge> | <zoil> because of the type family? |
| 2025-12-01 00:51:27 | <glguy> | You couldn't but that won't help if it's as simple as a Data.Proxy.Proxy (which contains no type information at runtime) |
| 2025-12-01 00:51:29 | <haskellbridge> | <zoil> or does it just work the way id like it too! :_D |
| 2025-12-01 00:51:47 | <haskellbridge> | <zoil> no type information at runtime! oh no! |
| 2025-12-01 00:51:56 | <glguy> | You'd have to make a new GADTs so that at runtime you can learn which type is needed via case |
| 2025-12-01 00:52:00 | <haskellbridge> | <zoil> that sounds like the kind of thing the compiler is fussy about |
| 2025-12-01 00:52:08 | <Leary> | zoil: You would need e.g. `data WhichNE xs where { IsCons :: WhichNE (Cons x xs); IsLast :: WhichNE (Last x) }; class KnownNE ne where { knownNE :: WhichNE ne }; <both instances>; instance KnownNE xs => Read (Transfers xs) where { read s = case knownNE of { ... } }`. |
| 2025-12-01 00:52:21 | <glguy> | It's not that it's fussy; it's just that it if the information has been erased, you can't use it |
| 2025-12-01 00:52:35 | <haskellbridge> | <zoil> glguy: I could do that! i just dont want constraints all over the place from recusrive classes that cant be asserted to be exhaustive |
| 2025-12-01 00:53:03 | <haskellbridge> | <zoil> i dont see why it would erase type information from a proxy, thats all they are for! crazy compiler |
| 2025-12-01 00:53:07 | <glguy> | read doesn't have a place to put the runtime type witness, it's type is fixed by the type class definition |
| 2025-12-01 00:53:19 | <glguy> | proxies are not for runtime type information |
All times are in UTC.