Newest at the top
2024-07-07 16:12:37 +0200 | wlhn | (~wlhn@dl46fx8hbfttwvhb-h1ly-3.rev.dnainternet.fi) (Quit: Leaving) |
2024-07-07 16:04:17 +0200 | <tomsmeding> | but that really only replaces a very marginal bit of your code :p |
2024-07-07 16:03:51 +0200 | <tomsmeding> | that's a bit of Generics magic there |
2024-07-07 16:03:41 +0200 | <tomsmeding> | one could write a function that creates a D from some T if there's only one constructor of D that has a field of type T (possibly nested in Either), and furthermore that constructor of D has no other fields |
2024-07-07 16:02:43 +0200 | <tomsmeding> | you'd still need to provide a mapping from PkgManager to the constructors of Mode.PkgManager |
2024-07-07 16:02:23 +0200 | <tomsmeding> | still, what would the magical solution even do, precisely? |
2024-07-07 16:00:30 +0200 | <tomsmeding> | there's sensibility, and then there's fun :p |
2024-07-07 16:00:21 +0200 | poscat | (~poscat@user/poscat) |
2024-07-07 16:00:15 +0200 | <hololeap> | I kinda want to try the magical solution, just for the challenge, but you make good points :) |
2024-07-07 16:00:05 +0200 | poscat | (~poscat@user/poscat) (Quit: Bye) |
2024-07-07 15:58:59 +0200 | <tomsmeding> | even though semantically, nothing really changed |
2024-07-07 15:58:47 +0200 | <tomsmeding> | then suddenly the generics/Data/whatever magic would have to do inter-datatype analysis |
2024-07-07 15:58:26 +0200 | <tomsmeding> | what if there's another data type in between? |
2024-07-07 15:58:15 +0200 | <tomsmeding> | it's just a feeling that I have, but I suspect that the equivalence here (that ReinstallAtomsMode is a field of Portage precisely because it's valid with Portage) is somewhat accidental |
2024-07-07 15:57:37 +0200 | <tomsmeding> | to me that feels like a more appropriate solution here than trying to infer semantical structure from the data types |
2024-07-07 15:57:03 +0200 | <hololeap> | yeah, that makes sense |
2024-07-07 15:55:34 +0200 | <tomsmeding> | then you cut down on the combinatorial explosion |
2024-07-07 15:55:10 +0200 | <tomsmeding> | if so, perhaps you can have a separate function first that tries to combine the cmdLineMode and the cmdLineTarget into `Either RunMode ReinstallAtomsMode` |
2024-07-07 15:54:29 +0200 | <tomsmeding> | hololeap: am I correct that a "target" (whether it's a Target, a CustomTargets, or a ReinstallAtomsTarget) is always eventually a part of the "mode" (be it RunMode or ReinstallAtomsMode)? |
2024-07-07 15:53:01 +0200 | <hololeap> | and I was planning on adding a couple more for that mode, so the case statement is getting unruley. I suppose the best thing to do would be to make reinstall-atoms mode a separate command with its own options |
2024-07-07 15:51:01 +0200 | <tomsmeding> | right, I see |
2024-07-07 15:50:55 +0200 | <hololeap> | mostly, yes. however there is also a --target=... option which has a couple that are only valid with --mode=reinstall-atoms |
2024-07-07 15:48:41 +0200 | <tomsmeding> | in any case this whole thing is only really relevant for ReinstallAtomsMode, right? The others are orthogonal |
2024-07-07 15:48:08 +0200 | <hololeap> | maybe :p |
2024-07-07 15:48:00 +0200 | <tomsmeding> | s/make a/make a value of a/ |
2024-07-07 15:47:49 +0200 | <tomsmeding> | have I been unnecessarily hung up on the phrasing of your original question, where you asked for how to "check if" instead of how to make a data type given one of the fields? |
2024-07-07 15:46:51 +0200 | <hololeap> | the "reinstall-atoms" mode is something that only makes sense with the portage package manager, since it has the features to implement it. it's a special mode that I made with portage's features in mind |
2024-07-07 15:46:29 +0200 | <tomsmeding> | I see, so you're doing exactly what I was suggesting, in a way |
2024-07-07 15:45:06 +0200 | <hololeap> | https://github.com/gentoo-haskell/haskell-updater/blob/master/Distribution/Gentoo/Types/HUMode.hs |
2024-07-07 15:44:46 +0200 | <hololeap> | https://github.com/gentoo-haskell/haskell-updater/blob/master/Distribution/Gentoo/CmdLine.hs#L37-L99 |
2024-07-07 15:43:07 +0200 | <tomsmeding> | but then you need more than just the fact that ReinstallAtomsMode occurs within Portage, right? You also need a function that makes you a Portage given a ReinstallAtomsMode |
2024-07-07 15:42:29 +0200 | <hololeap> | that's actually what I was following. I have a model of all the possible command line combinations, and I'm trying to "parse" it into the ADT that encodes all the valid mode combinations |
2024-07-07 15:41:24 +0200 | <tomsmeding> | at the risk of cargo-culting, I'm trying to find out if this is a case where parse-don't-validate is applicable |
2024-07-07 15:40:47 +0200 | <tomsmeding> | Can you do the check _there_ instead of crashing? |
2024-07-07 15:40:39 +0200 | <tomsmeding> | would something crash? What would? |
2024-07-07 15:40:33 +0200 | <tomsmeding> | hololeap: okay sure, but what would happen if you'd just remove that case statement? |
2024-07-07 15:39:07 +0200 | <hololeap> | currently I have a big case statement that checks for any incompatible options, but it's big and annoying and error prone |
2024-07-07 15:37:14 +0200 | <hololeap> | tomsmeding: it's because the user is capable of doing --package-manager=paludis --mode=reinstall-atoms and they need to be told that it's unsupported |
2024-07-07 15:34:17 +0200 | ubert | (~Thunderbi@p200300ecdf008f0f0a6872e022c3958c.dip0.t-ipconnect.de) |
2024-07-07 15:33:57 +0200 | ubert | (~Thunderbi@p200300ecdf008f0f0a6872e022c3958c.dip0.t-ipconnect.de) (Remote host closed the connection) |
2024-07-07 15:32:03 +0200 | nhar | (~noah@c-73-237-54-185.hsd1.ga.comcast.net) (Ping timeout: 264 seconds) |
2024-07-07 15:31:30 +0200 | <tomsmeding> | or something else is off |
2024-07-07 15:31:26 +0200 | <tomsmeding> | the moment you're asking for "does this field occur somewhere in this data type", it sounds to me like the data structures are the wrong way round |
2024-07-07 15:30:33 +0200 | <tomsmeding> | thereby making this whole generics/whatever dance redundant |
2024-07-07 15:30:08 +0200 | <tomsmeding> | because if so, that sounds like that function should just return a Maybe :p |
2024-07-07 15:29:57 +0200 | <tomsmeding> | is the idea that there is some partial function `ReinstallAtomsMode -> PkgManage` and you want to prevent it from failing? |
2024-07-07 15:29:34 +0200 | <tomsmeding> | hololeap: once you have this information (that ReinstallAtomsMode is only a descendant of Portage and not of other things), what are you going to do with that information? |
2024-07-07 15:23:47 +0200 | nhar | (~noah@c-73-237-54-185.hsd1.ga.comcast.net) |
2024-07-07 15:13:32 +0200 | target_i | (~target_i@user/target-i/x-6023099) |
2024-07-07 15:12:57 +0200 | sp1ff | (~user@c-73-11-70-111.hsd1.wa.comcast.net) |