Logs: freenode/#haskell
| 2020-10-01 08:07:25 | → | ddere joins (uid110888@gateway/web/irccloud.com/x-jowgaeystqlypvfd) |
| 2020-10-01 08:07:25 | → | thonkpod joins (~thonkpod@2001:19f0:ac01:b46:5400:1ff:fec7:d73d) |
| 2020-10-01 08:07:25 | → | entel joins (uid256215@botters/entel) |
| 2020-10-01 08:07:25 | → | eacameron joins (sid256985@gateway/web/irccloud.com/x-kpwlorbysgtnxhte) |
| 2020-10-01 08:07:25 | → | liff joins (liff@kapsi.fi) |
| 2020-10-01 08:07:25 | → | SolarAquarion joins (SolarAquar@gateway/shell/panicbnc/x-nikabmyijjgiqeue) |
| 2020-10-01 08:07:25 | → | jabruen[m] joins (jabruenmat@gateway/shell/matrix.org/x-akmaydnltwuauerf) |
| 2020-10-01 08:07:25 | → | PotatoHatsue joins (berbermanp@gateway/shell/matrix.org/x-lcuapfbpkatzswxh) |
| 2020-10-01 08:07:25 | → | glowcoil joins (sid3405@gateway/web/irccloud.com/x-thsriowqmdkgjing) |
| 2020-10-01 08:07:25 | → | rann joins (sid175221@gateway/web/irccloud.com/x-aedrxgorilstsgns) |
| 2020-10-01 08:07:25 | → | PoliticsII____ joins (sid193551@gateway/web/irccloud.com/x-nvfqluymqsvazvtl) |
| 2020-10-01 08:07:25 | → | angerman joins (sid209936@gateway/web/irccloud.com/x-kbnupcpypxlxxlnc) |
| 2020-10-01 08:07:25 | → | dequbed joins (~dequbed@yanduxian.paranoidlabs.org) |
| 2020-10-01 08:07:25 | → | koankeeper joins (sid216950@gateway/web/irccloud.com/x-zrkqcymdfzqfjfqv) |
| 2020-10-01 08:07:25 | → | teehemkay joins (sid14792@gateway/web/irccloud.com/x-xjwybgbmcxfolzwh) |
| 2020-10-01 08:07:25 | → | simony joins (sid226116@gateway/web/irccloud.com/x-ebcflagagczxghjj) |
| 2020-10-01 08:07:25 | → | miklcct joins (quasselcor@2001:19f0:7001:5ad:5400:2ff:feb6:50d7) |
| 2020-10-01 08:07:25 | → | mpickering joins (sid78412@gateway/web/irccloud.com/x-ugziboqyrxfitrmv) |
| 2020-10-01 08:07:25 | → | benwr__ joins (sid372383@gateway/web/irccloud.com/x-ehohzcwkyjbzpbwl) |
| 2020-10-01 08:07:25 | → | nlofaro joins (sid258233@gateway/web/irccloud.com/x-etxlydyigzmwkiap) |
| 2020-10-01 08:07:25 | → | unlink__ joins (~unlink2@p200300ebcf25bd0068eb9d9c94da2a17.dip0.t-ipconnect.de) |
| 2020-10-01 08:07:25 | → | srid joins (sridmatrix@gateway/shell/matrix.org/x-zqttickmrfyduksr) |
| 2020-10-01 08:07:25 | → | michaelpj1 joins (michaelpjm@gateway/shell/matrix.org/x-bmrqrkqdmdnabvkc) |
| 2020-10-01 08:07:25 | → | johnnyboy[m] joins (gifumatrix@gateway/shell/matrix.org/x-xczqbcixpmjhwvre) |
| 2020-10-01 08:07:25 | → | chreekat[m] joins (chreekatma@gateway/shell/matrix.org/x-umxlgtkybcwevjvb) |
| 2020-10-01 08:07:25 | → | lambdaclan joins (lambdaclan@gateway/shell/matrix.org/x-rosqvrjyauthsfym) |
| 2020-10-01 08:07:25 | → | io_r_us[m] joins (commandlin@gateway/shell/matrix.org/x-kjrwesnzoyenqgzx) |
| 2020-10-01 08:07:25 | → | barrucadu joins (~barrucadu@fsf/member/barrucadu) |
| 2020-10-01 08:07:25 | → | bcoppens_ joins (~bartcopp@vpn2.bartcoppens.be) |
| 2020-10-01 08:07:25 | → | noteness joins (~noteness@unaffiliated/nessessary129) |
| 2020-10-01 08:07:25 | → | opqdonut joins (opqdonut@pseudo.fixme.fi) |
| 2020-10-01 08:07:25 | → | Velpoman joins (~Velpoman@159.65.76.124) |
| 2020-10-01 08:07:25 | → | dixie joins (~dixie@real.wilbury.sk) |
| 2020-10-01 08:07:25 | → | uwap joins (~uwap@genja.uwap.name) |
| 2020-10-01 08:08:08 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-01 08:09:42 | → | cpressey joins (~cpressey@88.144.70.46) |
| 2020-10-01 08:11:03 | × | hekkaidekapus quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Ping timeout: 240 seconds) |
| 2020-10-01 08:12:22 | × | Igloo quits (~igloo@81.2.99.210) (Ping timeout: 258 seconds) |
| 2020-10-01 08:12:24 | × | tomku quits (~tomku@unaffiliated/tomku) (Ping timeout: 265 seconds) |
| 2020-10-01 08:13:19 | → | Igloo joins (~igloo@81.2.99.210) |
| 2020-10-01 08:13:25 | → | hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus) |
| 2020-10-01 08:14:19 | → | John20 joins (~John@82.46.59.122) |
| 2020-10-01 08:15:42 | <tomsmeding> | kindaro: to properly catch stuff like Maybe (Either String [(Bool, Int)]) you'll have to do instance resolution yourself I think, or find some TH function that does instance resolution for you |
| 2020-10-01 08:15:56 | <tomsmeding> | because as you stated, listing all such types won't terminate :p |
| 2020-10-01 08:16:02 | <tomsmeding> | (also, did you get my message via lambdabot?) |
| 2020-10-01 08:16:30 | <kindaro> | Yes. |
| 2020-10-01 08:17:02 | <kindaro> | In the mean time, I realized that what I wanted to do amounts to higher order Template Haskell. |
| 2020-10-01 08:17:35 | → | dhil joins (~dhil@11.29.39.217.dyn.plus.net) |
| 2020-10-01 08:17:36 | <kindaro> | So I switched from case expression to multi way if and it made the `Pat` thing disappear. |
| 2020-10-01 08:19:22 | <tomsmeding> | basically what you need is a dependently-typed function that given a _string_ describing the type, returns the appropriate read and show functions for that type, and you want that function to work for an infinite number (recursive family) of types |
| 2020-10-01 08:20:31 | <tomsmeding> | what is the business case? do you really want this for all types in scope, or just a particular set of them? |
| 2020-10-01 08:20:49 | → | motersen joins (~user@2001-4dd1-ce19-0-41b8-8f35-edf5-ff23.ipv6dyn.netcologne.de) |
| 2020-10-01 08:21:06 | <tomsmeding> | would it, for example, be acceptable to have to (automatically) derive an instance of a particular custom class for all the types that you want to show . read this way? |
| 2020-10-01 08:21:18 | → | thir joins (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de) |
| 2020-10-01 08:21:29 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-01 08:22:13 | → | todda7 joins (~torstein@athedsl-4518485.home.otenet.gr) |
| 2020-10-01 08:23:17 | <tomsmeding> | (that class would just include Show and Read constraints, but additionally export a function that, given a string naming a type, decides if that type belongs to that instance's type, and if so, tells you how to parse the types in the type parameter positions in the string and collect them together for the show,read functions) |
| 2020-10-01 08:23:21 | × | jonathanx quits (~jonathan@dyn-8-sc.cdg.chalmers.se) (Remote host closed the connection) |
| 2020-10-01 08:23:42 | <tomsmeding> | that function you could generate with generics |
| 2020-10-01 08:23:50 | → | tomku joins (~tomku@unaffiliated/tomku) |
| 2020-10-01 08:24:19 | → | jonathanx joins (~jonathan@dyn-8-sc.cdg.chalmers.se) |
| 2020-10-01 08:24:21 | <kindaro> | Yes, it would be healthy to mark all supported types by an instance of a certain class. |
| 2020-10-01 08:24:24 | <tomsmeding> | and then in templatehaskell, you don't have to do instance resolution anymore; you just get the list of instances of that custom class via reifyInstances, and then use the defined type name parsers to obtain your show/read functions |
| 2020-10-01 08:25:03 | <[exa]> | is there any explanation of why would cabal sdist mark CHANGELOG.md as executable? (related: why are unixtimes reset to 1Gsec ?) |
| 2020-10-01 08:25:10 | <tomsmeding> | an alternative direction is to use reifyInstances more: it can also accept a type with type parameters (not just 'a' as I've been doing), and tell you if that more-specified type is also an instance of the class |
| 2020-10-01 08:25:22 | × | whiteline quits (~whiteline@unaffiliated/whiteline) (Ping timeout: 246 seconds) |
| 2020-10-01 08:25:29 | <kindaro> | > given a string naming a type, decides if that type belongs to that instance's type, and if so, tells you how to parse the types in the type parameter positions in the string and collect them together |
| 2020-10-01 08:25:32 | <lambdabot> | <hint>:1:25: error: <hint>:1:25: error: parse error on input ‘type’ |
| 2020-10-01 08:25:35 | <kindaro> | I am not sure I follow you there. |
| 2020-10-01 08:25:54 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-10-01 08:25:56 | <tomsmeding> | yeah was being vague |
| 2020-10-01 08:26:42 | <tomsmeding> | not specifying exactly what data structures are involved, consider e.g. instance (Show a, Show b) => Show (Either a b) |
| 2020-10-01 08:26:49 | <tomsmeding> | (ignoring Read for the moment, because it's analogous) |
| 2020-10-01 08:27:02 | × | jedws quits (~jedws@121.209.139.222) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-10-01 08:27:42 | <tomsmeding> | then this custom class, which you'd derive for (Show a, Show b) => CustomClass (Either a b), would define a function 'parseType' or something that takes "Either String Bool" |
| 2020-10-01 08:27:54 | <tomsmeding> | would parse that string as "Either " + parameters |
| 2020-10-01 08:28:25 | <tomsmeding> | and return a data structure containing closures that tell the caller to parse the rest of the string recursively |
| 2020-10-01 08:28:25 | × | thir quits (~thir@p200300f27f0fc60094e773283d7bf825.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
| 2020-10-01 08:28:50 | <tomsmeding> | and a final closure that constructs the result (namely, the correct show/read functions) given the show/read functions of those contained types |
| 2020-10-01 08:29:14 | × | toorevitimirp quits (~tooreviti@117.182.181.38) (Ping timeout: 258 seconds) |
| 2020-10-01 08:29:55 | <tomsmeding> | maybe the data structure should only contain that final closure; the rest can be described with plain data (parameter starts at index 7, then parameter starts at index 1 after the last one's end; gimme the results from those two parameters, and I'll give you the show/read functions for the whole type) |
| 2020-10-01 08:30:03 | → | whiteline joins (~whiteline@unaffiliated/whiteline) |
| 2020-10-01 08:30:30 | <tomsmeding> | point being you escape TH for this part :p |
| 2020-10-01 08:32:25 | <tomsmeding> | you'd have to re-implement some of the automatically derived Read logic though |
| 2020-10-01 08:33:01 | <dminuoso> | kindaro: The most sensible thing I can come up with, is if that program uses GHCi. |
| 2020-10-01 08:33:18 | → | thc202 joins (~thc202@unaffiliated/thc202) |
| 2020-10-01 08:33:41 | <dminuoso> | Such that the invocation of `show . read` happens interactively in GHCi at types determined at runtime. |
| 2020-10-01 08:34:08 | tomsmeding | realises that's a far better idea |
| 2020-10-01 08:34:44 | × | mud quits (~mud@unaffiliated/kadoban) (Remote host closed the connection) |
| 2020-10-01 08:34:52 | <kindaro> | Do we have something like GHCi API? |
| 2020-10-01 08:34:58 | <lortabac> | @hackage hint |
| 2020-10-01 08:34:59 | <lambdabot> | https://hackage.haskell.org/package/hint |
| 2020-10-01 08:35:11 | → | mud joins (~mud@unaffiliated/kadoban) |
| 2020-10-01 08:35:12 | <lortabac> | kindaro: maybe this ^ |
| 2020-10-01 08:35:27 | <kindaro> | What a time to be alive! |
| 2020-10-01 08:36:02 | <kindaro> | I imagine I could have saved some hours. On the other hand, I had a nice exercise in Template Haskell. |
| 2020-10-01 08:36:26 | × | Sanchayan quits (~Sanchayan@223.226.111.203) (Quit: leaving) |
| 2020-10-01 08:37:11 | <lortabac> | kindaro: funny thing is, I wanted to suggest you this solution the other day, but you went offline right before I could finish my sentence |
| 2020-10-01 08:37:40 | <tomsmeding> | [exa]: it seems it marks all extra-source-files as executable? |
| 2020-10-01 08:37:42 | → | conal joins (~conal@64.71.133.70) |
All times are in UTC.