2024-11-20 00:03:12 +0100 | <geekosaur> | I still don't know how you think that would work |
2024-11-20 00:03:17 +0100 | <geekosaur> | think about it |
2024-11-20 00:04:52 +0100 | <geekosaur> | "Magic" would be quite literal |
2024-11-20 00:05:43 +0100 | <Leary> | I mean, GHC could just do the inlining for you. Not like it doesn't already do plenty of that. |
2024-11-20 00:07:24 +0100 | <hellwolf> | the fact is it worked. I take that as a magic. |
2024-11-20 00:07:33 +0100 | <hellwolf> | *works |
2024-11-20 00:17:30 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) L29Ah |
2024-11-20 00:21:51 +0100 | <hellwolf> | I also defined I8,I16..I256, U8,U16...U256, all without TH. I can now replace that with the magic too. Can you actually do such a splice in the module export list too? I guess that's where the magic is limited? |
2024-11-20 00:22:22 +0100 | <hellwolf> | module XYZ ( ... U8, U16, ... U256,...) |
2024-11-20 00:28:20 +0100 | <geekosaur> | things defined via TH can be exported, yes |
2024-11-20 00:29:52 +0100 | Smiles | (uid551636@id-551636.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
2024-11-20 00:32:18 +0100 | <hellwolf> | right. I am more curious about if one can go one step of further of not to write this manually |
2024-11-20 00:32:18 +0100 | <hellwolf> | -- *** Assorted INTx Types |
2024-11-20 00:32:18 +0100 | <hellwolf> | , U8,U16,U24,U32,U40,U48,U56,U64 |
2024-11-20 00:32:18 +0100 | <hellwolf> | ... and so on, in the module export list |
2024-11-20 00:32:18 +0100 | <hellwolf> | ... but I am quite content already comparing to where I was few hours ago about this part of the code. |
2024-11-20 00:33:00 +0100 | <geekosaur> | I don't think you can, no; it'd be kinda the extreme case of the staging restriction |
2024-11-20 00:33:00 +0100 | remexre | (~remexre@user/remexre) (Ping timeout: 252 seconds) |
2024-11-20 00:34:14 +0100 | Eoco | (~ian@128.101.131.218) (Ping timeout: 272 seconds) |
2024-11-20 00:34:39 +0100 | sawilagar | (~sawilagar@user/sawilagar) (Ping timeout: 265 seconds) |
2024-11-20 00:35:35 +0100 | remexre | (~remexre@user/remexre) remexre |
2024-11-20 00:36:01 +0100 | Eoco | (~ian@128.101.131.218) Eoco |
2024-11-20 00:36:06 +0100 | JuanDaugherty | (~juan@user/JuanDaugherty) JuanDaugherty |
2024-11-20 00:40:42 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) machinedgod |
2024-11-20 00:41:02 +0100 | mange | (~user@user/mange) (Remote host closed the connection) |
2024-11-20 00:42:18 +0100 | notzmv | (~umar@user/notzmv) notzmv |
2024-11-20 01:01:33 +0100 | mange | (~user@user/mange) mange |
2024-11-20 01:04:09 +0100 | Axman6 | (~Axman6@user/axman6) (Ping timeout: 240 seconds) |
2024-11-20 01:06:59 +0100 | Sgeo | (~Sgeo@user/sgeo) Sgeo |
2024-11-20 01:08:25 +0100 | Everything | (~Everythin@46-133-188-81.mobile.vf-ua.net) (Quit: leaving) |
2024-11-20 01:08:45 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f33ad61be24cfbe8605.dip0.t-ipconnect.de) (Ping timeout: 252 seconds) |
2024-11-20 01:10:49 +0100 | misterfish | (~misterfis@84.53.85.146) (Ping timeout: 260 seconds) |
2024-11-20 01:19:50 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 272 seconds) |
2024-11-20 01:20:38 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
2024-11-20 01:33:03 +0100 | sprotte24 | (~sprotte24@p200300d16f3e1d0004a3986a39ff8486.dip0.t-ipconnect.de) (Read error: Connection reset by peer) |
2024-11-20 01:36:25 +0100 | JuanDaugherty | (~juan@user/JuanDaugherty) (Quit: JuanDaugherty) |
2024-11-20 01:37:48 +0100 | Axman6 | (~Axman6@user/axman6) Axman6 |
2024-11-20 01:40:16 +0100 | son0p | (~ff@2800:e2:f80:ee7::4) son0p |
2024-11-20 01:40:16 +0100 | troojg | (~troojg@user/troojg) troojg |
2024-11-20 01:43:41 +0100 | <hellwolf> | forM [ (s, n) | s <- [True, False], n <- [1..32] ] $ \(s, n) -> do |
2024-11-20 01:43:41 +0100 | <hellwolf> | name <- TH.newName ((if s then "I" else "U") ++ show (n * 8)) |
2024-11-20 01:43:41 +0100 | <hellwolf> | TH.tySynD name [] ((TH.conT ''INTx) |
2024-11-20 01:43:41 +0100 | <hellwolf> | `TH.appT` (TH.promotedT (if s then 'True else 'False)) |
2024-11-20 01:43:41 +0100 | <hellwolf> | `TH.appT` (TH.litT (TH.numTyLit n))) |
2024-11-20 01:43:44 +0100 | <hellwolf> | This is amazing |
2024-11-20 01:43:54 +0100 | <hellwolf> | Thanks for teaching me this today. |
2024-11-20 01:45:14 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-11-20 01:53:30 +0100 | hsw_ | (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) hsw |
2024-11-20 01:53:52 +0100 | hsw | (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Read error: Connection reset by peer) |
2024-11-20 01:58:00 +0100 | <Axman6> | if s then 'True else 'False made me sad but then realised it's not id |
2024-11-20 01:58:44 +0100 | <Axman6> | hellwolf: why limit it to multiples of 8? We use a lot of 18 bit ints at work =) |
2024-11-20 01:59:25 +0100 | <geekosaur> | pdp7? 😛 |
2024-11-20 01:59:41 +0100 | <Axman6> | FPGAs |
2024-11-20 01:59:57 +0100 | <geekosaur> | …everything old is new again |
2024-11-20 02:00:06 +0100 | <Axman6> | the DSPs we have do 18x25 bit multiplications (IIRC) |
2024-11-20 02:02:17 +0100 | <Axman6> | hellwolf: you might also want to look at how Clash does numbers |
2024-11-20 02:03:29 +0100 | <hellwolf> | Yea, I wonder if there is better way of doing that 'True 'False thing :) I guess the domain I am dealing with spared me with non octal trite... |
2024-11-20 02:03:44 +0100 | <hellwolf> | Axman6: yes I should checkout clash, heard a lot about it... |
2024-11-20 02:05:07 +0100 | <Axman6> | I love it, I wish we'd use it at work, VHDL is such a horrific language |
2024-11-20 02:16:44 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 244 seconds) |
2024-11-20 02:17:48 +0100 | JuanDaugherty | (~juan@user/JuanDaugherty) JuanDaugherty |
2024-11-20 02:23:50 +0100 | housemate | (~housemate@2a04:9dc0:0:162::5d91:d7ed) (Quit: Nothing to see here. I wasn't there.) |
2024-11-20 02:30:36 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Remote host closed the connection) |
2024-11-20 02:31:21 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 02:39:04 +0100 | Tuplanolla | (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) (Quit: Leaving.) |
2024-11-20 02:42:03 +0100 | Alleria_ | (~Alleria@user/alleria) Alleria |
2024-11-20 02:44:09 +0100 | Alleria | (~Alleria@user/alleria) (Ping timeout: 252 seconds) |
2024-11-20 02:55:12 +0100 | hsw_ | (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Quit: Leaving) |
2024-11-20 02:55:24 +0100 | hsw | (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) hsw |
2024-11-20 02:59:18 +0100 | Alleria | (~Alleria@user/alleria) Alleria |
2024-11-20 03:03:04 +0100 | Alleria_ | (~Alleria@user/alleria) (Ping timeout: 272 seconds) |
2024-11-20 03:08:59 +0100 | gmg | (~user@user/gehmehgeh) (Remote host closed the connection) |
2024-11-20 03:09:12 +0100 | Alleria | (~Alleria@user/alleria) (Ping timeout: 252 seconds) |
2024-11-20 03:13:18 +0100 | gmg | (~user@user/gehmehgeh) gehmehgeh |
2024-11-20 03:17:12 +0100 | JuanDaugherty | (~juan@user/JuanDaugherty) (Quit: JuanDaugherty) |
2024-11-20 03:23:22 +0100 | Alleria | (~Alleria@user/alleria) Alleria |
2024-11-20 03:30:18 +0100 | troojg | (~troojg@user/troojg) (Ping timeout: 272 seconds) |
2024-11-20 03:35:29 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 252 seconds) |
2024-11-20 03:36:41 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-11-20 04:02:05 +0100 | <Axman6> | any python devs know of a python equivalent to insertWith max k v dict? |
2024-11-20 04:13:59 +0100 | <edwardk> | hellwolf: re the export list, you can of course skip using an explicit export list. the least amount of code is no code at all there. |
2024-11-20 04:14:00 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) (Ping timeout: 252 seconds) |
2024-11-20 04:15:45 +0100 | forell | (~forell@user/forell) (Ping timeout: 276 seconds) |
2024-11-20 04:23:16 +0100 | vanishingideal | (~vanishing@user/vanishingideal) vanishingideal |
2024-11-20 04:36:22 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds) |
2024-11-20 04:41:57 +0100 | rekahsoft | (~rekahsoft@bras-base-orllon1103w-grc-06-76-69-85-220.dsl.bell.ca) rekahsoft |
2024-11-20 04:43:47 +0100 | pavonia | (~user@user/siracusa) (Quit: Bye!) |
2024-11-20 04:47:48 +0100 | Alleria | (~Alleria@user/alleria) (Remote host closed the connection) |
2024-11-20 04:48:30 +0100 | Alleria | (~Alleria@user/alleria) Alleria |
2024-11-20 04:59:58 +0100 | Me-me | (~me-me@user/me-me) (Quit: Disconnecting on purpose.) |
2024-11-20 05:00:58 +0100 | Me-me | (~me-me@kc.randomserver.name) |
2024-11-20 05:26:27 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) bitdex |
2024-11-20 05:28:04 +0100 | rekahsoft | (~rekahsoft@bras-base-orllon1103w-grc-06-76-69-85-220.dsl.bell.ca) (Ping timeout: 252 seconds) |
2024-11-20 06:08:39 +0100 | sand-witch_ | (~m-mzmz6l@vmi833741.contaboserver.net) |
2024-11-20 06:09:29 +0100 | sand-witch | (~m-mzmz6l@vmi833741.contaboserver.net) (Ping timeout: 252 seconds) |
2024-11-20 06:13:32 +0100 | sand-witch_ | sand-witch |
2024-11-20 06:17:25 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-11-20 06:19:21 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) (Ping timeout: 260 seconds) |
2024-11-20 06:19:23 +0100 | alphazone | (~alphazone@2.219.56.221) (Ping timeout: 252 seconds) |
2024-11-20 06:21:07 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) ChaiTRex |
2024-11-20 06:33:08 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 255 seconds) |
2024-11-20 06:44:46 +0100 | michalz | (~michalz@185.246.207.217) |
2024-11-20 06:50:15 +0100 | statusbot | (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com) statusbot |
2024-11-20 06:53:51 +0100 | statusbot7 | (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com) (Ping timeout: 252 seconds) |
2024-11-20 06:57:50 +0100 | tt12310978324354 | (~tt1231@syn-075-185-104-199.res.spectrum.com) tt1231 |
2024-11-20 06:58:39 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 260 seconds) |
2024-11-20 06:59:13 +0100 | tt1231097832435 | (~tt1231@2603:6010:8700:4a81:219f:50d3:618a:a6ee) (Ping timeout: 248 seconds) |
2024-11-20 06:59:14 +0100 | tt12310978324354 | tt1231097832435 |
2024-11-20 07:01:33 +0100 | anpad | (~pandeyan@user/anpad) (Quit: ZNC 1.8.2 - https://znc.in) |
2024-11-20 07:02:17 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 07:04:36 +0100 | alphazone | (~alphazone@2.219.56.221) |
2024-11-20 07:11:06 +0100 | ft | (~ft@p4fc2a26f.dip0.t-ipconnect.de) (Ping timeout: 252 seconds) |
2024-11-20 07:12:48 +0100 | ft | (~ft@p508dbc6e.dip0.t-ipconnect.de) ft |
2024-11-20 07:14:58 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 245 seconds) |
2024-11-20 07:16:37 +0100 | anpad | (~pandeyan@user/anpad) anpad |
2024-11-20 07:19:36 +0100 | notzmv | (~umar@user/notzmv) (Read error: Connection reset by peer) |
2024-11-20 07:25:33 +0100 | mange | (~user@user/mange) (Remote host closed the connection) |
2024-11-20 07:26:05 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 07:30:03 +0100 | Sgeo | (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
2024-11-20 07:33:31 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-11-20 07:36:15 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) |
2024-11-20 07:39:49 +0100 | alphazone | (~alphazone@2.219.56.221) (Ping timeout: 248 seconds) |
2024-11-20 07:40:25 +0100 | ubert | (~Thunderbi@178.115.41.15.wireless.dyn.drei.com) ubert |
2024-11-20 07:55:00 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43cc25887be993a47b.dip0.t-ipconnect.de) acidjnk |
2024-11-20 08:04:59 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 252 seconds) |
2024-11-20 08:15:27 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 08:16:01 +0100 | zlqrvx | (~zlqrvx@user/zlqrvx) (Quit: %quit%) |
2024-11-20 08:16:46 +0100 | sord937 | (~sord937@gateway/tor-sasl/sord937) sord937 |
2024-11-20 08:17:21 +0100 | zlqrvx | (~zlqrvx@user/zlqrvx) zlqrvx |
2024-11-20 08:29:09 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 246 seconds) |
2024-11-20 08:32:15 +0100 | <dminuoso> | bwe: The description is true, but not really relevant today. Mostly just a fun remark about history. |
2024-11-20 08:33:28 +0100 | Square2 | (~Square4@user/square) Square |
2024-11-20 08:36:40 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 08:40:34 +0100 | caconym | (~caconym@user/caconym) (Quit: bye) |
2024-11-20 08:45:17 +0100 | sawilagar | (~sawilagar@user/sawilagar) sawilagar |
2024-11-20 08:46:29 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 248 seconds) |
2024-11-20 08:57:43 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2024-11-20 08:58:11 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 09:00:56 +0100 | olivial | (~benjaminl@user/benjaminl) (Read error: Connection reset by peer) |
2024-11-20 09:01:12 +0100 | olivial | (~benjaminl@user/benjaminl) benjaminl |
2024-11-20 09:01:36 +0100 | GdeVolpiano | (~GdeVolpia@user/GdeVolpiano) (Quit: WeeChat 4.4.2) |
2024-11-20 09:04:24 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 252 seconds) |
2024-11-20 09:07:18 +0100 | Perseverance | (~Persevera@2.219.56.221) |
2024-11-20 09:08:11 +0100 | <haskellbridge> | <hellwolf> edwardk: yes, that's true. |
2024-11-20 09:08:11 +0100 | <haskellbridge> | ... long message truncated: https://kf8nh.com/_heisenbridge/media/kf8nh.com/lsAZXCpcYCpLcHAgzwCoIQAw/t5OqeCcG3NM (3 lines) |
2024-11-20 09:10:18 +0100 | misterfish | (~misterfis@84.53.85.146) misterfish |
2024-11-20 09:14:56 +0100 | <haskellbridge> | <hellwolf> Also, if I take that thing in a separate module of its own, then I can be more comfortable letting module export list to be inexplicit. |
2024-11-20 09:14:58 +0100 | <haskellbridge> | But now I am just splitting hairs. |
2024-11-20 09:18:23 +0100 | xdej | (~xdej@quatramaran.salle-s.org) |
2024-11-20 09:18:28 +0100 | GdeVolpiano | (~GdeVolpia@user/GdeVolpiano) GdeVolpiano |
2024-11-20 09:19:21 +0100 | Perseverance | (~Persevera@2.219.56.221) (Ping timeout: 252 seconds) |
2024-11-20 09:21:52 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) lortabac |
2024-11-20 09:28:40 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 244 seconds) |
2024-11-20 09:31:40 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 09:36:37 +0100 | Perseverance | (~Persevera@2.219.56.221) |
2024-11-20 09:38:33 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-11-20 09:38:45 +0100 | euleritian | (~euleritia@dynamic-176-006-132-236.176.6.pool.telefonica.de) |
2024-11-20 09:39:06 +0100 | euleritian | (~euleritia@dynamic-176-006-132-236.176.6.pool.telefonica.de) (Read error: Connection reset by peer) |
2024-11-20 09:39:22 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 09:40:20 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 265 seconds) |
2024-11-20 09:49:56 +0100 | stiell_ | (~stiell@gateway/tor-sasl/stiell) (Ping timeout: 260 seconds) |
2024-11-20 09:50:16 +0100 | stiell_ | (~stiell@gateway/tor-sasl/stiell) stiell |
2024-11-20 09:50:48 +0100 | GdeVolpiano | (~GdeVolpia@user/GdeVolpiano) (Quit: WeeChat 4.4.2) |
2024-11-20 09:51:26 +0100 | GdeVolpiano | (~GdeVolpia@user/GdeVolpiano) GdeVolpiano |
2024-11-20 09:53:20 +0100 | ft | (~ft@p508dbc6e.dip0.t-ipconnect.de) (Quit: leaving) |
2024-11-20 09:57:28 +0100 | <bwe> | dminuoso: then, what's the essence of it that's relevant today? |
2024-11-20 09:57:37 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) machinedgod |
2024-11-20 09:58:17 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2024-11-20 09:58:44 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 10:03:35 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-11-20 10:03:48 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 10:06:21 +0100 | evocatus | (~evocatus@2a02:a210:20c2:d600:1496:234e:dc9f:5868) evocatus |
2024-11-20 10:08:11 +0100 | Smiles | (uid551636@id-551636.lymington.irccloud.com) Smiles |
2024-11-20 10:10:02 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 252 seconds) |
2024-11-20 10:10:39 +0100 | evocatus | (~evocatus@2a02:a210:20c2:d600:1496:234e:dc9f:5868) (Ping timeout: 246 seconds) |
2024-11-20 10:16:38 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2024-11-20 10:17:18 +0100 | CrunchyFlakes | (~CrunchyFl@ip1f13e94e.dynamic.kabel-deutschland.de) |
2024-11-20 10:24:49 +0100 | Guest68 | (~Guest68@2405:201:12:391a:c627:4da6:1387:26ef) |
2024-11-20 10:25:15 +0100 | <Guest68> | @free showList :: (a -> String) -> [a] -> String |
2024-11-20 10:25:15 +0100 | <lambdabot> | showList . (.) f = (.) (showList f) . $map |
2024-11-20 10:27:12 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.4.2) |
2024-11-20 10:27:23 +0100 | <Guest68> | @free showList :: [a] -> String |
2024-11-20 10:27:23 +0100 | <lambdabot> | showList = showList . $map f |
2024-11-20 10:30:02 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 10:36:12 +0100 | <Guest68> | @free evaluate :: Expr a -> a |
2024-11-20 10:36:12 +0100 | <lambdabot> | f . evaluate = evaluate . $map_Expr f |
2024-11-20 10:37:04 +0100 | <[exa]> | Guest68: you may also do `/query lambdabot` and ask in private |
2024-11-20 10:37:21 +0100 | <Guest68> | Oh, thank you. I'll try that. |
2024-11-20 10:38:27 +0100 | <[exa]> | like, not a big issue, just that the attempts here get auto-streamed to at least 500 people :D |
2024-11-20 10:40:55 +0100 | <kaol> | History question: Was there a time when Arrow just assumed arr used (->) instead of being a type class taking a Category? |
2024-11-20 10:41:52 +0100 | <ncf> | what, like arr :: (b -> c) -> b -> c ? |
2024-11-20 10:42:05 +0100 | <ncf> | there aren't many of those... |
2024-11-20 10:43:31 +0100 | jespada | (~jespada@cpc121308-nmal25-2-0-cust15.19-2.cable.virginm.net) (Quit: Textual IRC Client: www.textualapp.com) |
2024-11-20 10:46:06 +0100 | __monty__ | (~toonn@user/toonn) toonn |
2024-11-20 10:46:07 +0100 | <kaol> | It could be that it's just that I had been introduced to arrows with a simple "arr is like lifting a function to it" and I didn't get the bigger picture then. |
2024-11-20 10:48:59 +0100 | jespada | (~jespada@cpc121308-nmal25-2-0-cust15.19-2.cable.virginm.net) jespada |
2024-11-20 10:50:00 +0100 | tzh | (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz) |
2024-11-20 10:52:09 +0100 | mari-estel | (~mari-este@user/mari-estel) mari-estel |
2024-11-20 10:54:11 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
2024-11-20 10:54:11 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) (Read error: Connection reset by peer) |
2024-11-20 10:54:12 +0100 | stiell_ | (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
2024-11-20 10:54:28 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) chexum |
2024-11-20 10:54:34 +0100 | stiell_ | (~stiell@gateway/tor-sasl/stiell) stiell |
2024-11-20 10:54:41 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) ChaiTRex |
2024-11-20 10:57:18 +0100 | ljdarj | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 10:59:10 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 252 seconds) |
2024-11-20 11:03:30 +0100 | mari-estel | (~mari-este@user/mari-estel) (Quit: shitty teams) |
2024-11-20 11:05:48 +0100 | chele | (~chele@user/chele) chele |
2024-11-20 11:07:32 +0100 | aforemny | (~aforemny@i59F4C7F0.versanet.de) aforemny |
2024-11-20 11:09:42 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en |
2024-11-20 11:12:09 +0100 | lxsameer | (~lxsameer@Serene/lxsameer) lxsameer |
2024-11-20 11:14:18 +0100 | aforemny | (~aforemny@i59F4C7F0.versanet.de) (Ping timeout: 252 seconds) |
2024-11-20 11:14:21 +0100 | aforemny_ | (~aforemny@2001:9e8:6cf0:9800:3be1:8adc:eacb:81a7) aforemny |
2024-11-20 11:14:30 +0100 | Guest68 | (~Guest68@2405:201:12:391a:c627:4da6:1387:26ef) (Quit: Client closed) |
2024-11-20 11:15:06 +0100 | <jackdk> | ISTR old versions of GHC shipping class Arrow without a superclass |
2024-11-20 11:16:23 +0100 | <int-e> | ISTR old versions of GHC not shipping Arrow at all |
2024-11-20 11:24:03 +0100 | mari-estel | (~mari-este@user/mari-estel) mari-estel |
2024-11-20 11:24:45 +0100 | drdo | (~drdo@bl9-110-63.dsl.telepac.pt) (Ping timeout: 276 seconds) |
2024-11-20 11:29:58 +0100 | <jackdk> | You're probably thinking of even older versions |
2024-11-20 11:32:10 +0100 | <kaol> | The first drafts of Haskell didn't have monads. |
2024-11-20 11:35:48 +0100 | Guest25 | (~Guest25@87-94-152-62.rev.dnainternet.fi) |
2024-11-20 11:36:34 +0100 | Buliarous | (~gypsydang@46.232.210.139) (Ping timeout: 252 seconds) |
2024-11-20 11:36:56 +0100 | lortabac | (~lortabac@37.171.105.2) lortabac |
2024-11-20 11:38:20 +0100 | Buliarous | (~gypsydang@46.232.210.139) Buliarous |
2024-11-20 11:40:21 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 11:40:56 +0100 | son0p | (~ff@2800:e2:f80:ee7::4) (Ping timeout: 244 seconds) |
2024-11-20 11:47:31 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 264 seconds) |
2024-11-20 11:49:52 +0100 | pavonia | (~user@user/siracusa) siracusa |
2024-11-20 11:50:03 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43cc25887be993a47b.dip0.t-ipconnect.de) (Ping timeout: 252 seconds) |
2024-11-20 11:50:48 +0100 | lortabac | (~lortabac@37.171.105.2) (Read error: Connection reset by peer) |
2024-11-20 11:53:10 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 11:54:30 +0100 | drdo | (~drdo@bl9-110-63.dsl.telepac.pt) drdo |
2024-11-20 12:00:51 +0100 | Guest68 | (~Guest68@2405:201:12:391a:c627:4da6:1387:26ef) |
2024-11-20 12:01:54 +0100 | Guest68 | (~Guest68@2405:201:12:391a:c627:4da6:1387:26ef) (Client Quit) |
2024-11-20 12:03:43 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 264 seconds) |
2024-11-20 12:06:32 +0100 | hsw | (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Remote host closed the connection) |
2024-11-20 12:06:40 +0100 | hsw | (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) hsw |
2024-11-20 12:07:35 +0100 | Guest25 | (~Guest25@87-94-152-62.rev.dnainternet.fi) (Ping timeout: 256 seconds) |
2024-11-20 12:07:57 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43cc25887be993a47b.dip0.t-ipconnect.de) acidjnk |
2024-11-20 12:08:40 +0100 | mari97681 | (~mari-este@user/mari-estel) mari-estel |
2024-11-20 12:10:22 +0100 | mari-estel | (~mari-este@user/mari-estel) (Read error: Connection reset by peer) |
2024-11-20 12:11:18 +0100 | mari-estel | (~mari-este@user/mari-estel) mari-estel |
2024-11-20 12:13:47 +0100 | mari97681 | (~mari-este@user/mari-estel) (Ping timeout: 255 seconds) |
2024-11-20 12:19:37 +0100 | zlqrvx | (~zlqrvx@user/zlqrvx) (Quit: %quit%) |
2024-11-20 12:20:53 +0100 | zlqrvx | (~zlqrvx@user/zlqrvx) zlqrvx |
2024-11-20 12:21:00 +0100 | <probie> | kaol: Drafts? Monads are completely absent from 1.2. It's not until 1.3 they turn up |
2024-11-20 12:30:07 +0100 | <kaol> | I was thinking in terms of anything before Haskell 98 being drafts. True, that's going a bit fast and loose. |
2024-11-20 12:33:30 +0100 | zlqrvx | (~zlqrvx@user/zlqrvx) (Quit: %quit%) |
2024-11-20 12:33:57 +0100 | zlqrvx | (~zlqrvx@user/zlqrvx) zlqrvx |
2024-11-20 12:45:01 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 12:48:58 +0100 | <dminuoso> | bwe: Humor has never become irrelevant. :-) |
2024-11-20 12:50:30 +0100 | <dminuoso> | kaol: Given that most haskellers are writing in non-standardized Haskell these days, it's all back to draft then. |
2024-11-20 12:50:33 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 252 seconds) |
2024-11-20 12:50:41 +0100 | <dminuoso> | A new Haskell standard is probably not coming. |
2024-11-20 12:51:03 +0100 | <dminuoso> | Haskell2020 never succeeded. |
2024-11-20 12:51:54 +0100 | jinsun | (~jinsun@user/jinsun) jinsun |
2024-11-20 12:52:42 +0100 | alp_ | (~alp@2001:861:8ca0:4940:483b:a21e:7fb4:76cd) (Remote host closed the connection) |
2024-11-20 12:52:59 +0100 | alp_ | (~alp@2001:861:8ca0:4940:97d6:816b:8add:3996) |
2024-11-20 12:53:04 +0100 | <mari-estel> | the age of standards is over. Now it is either: survive with your implementation or get a big company push their opinionated framework |
2024-11-20 12:55:46 +0100 | <bwe> | dminuoso: so which way other than searching through github repos are we left with to learn and find the approaches to adopt for yourself? |
2024-11-20 12:56:17 +0100 | <mari-estel> | let trained machines tell you how it is right |
2024-11-20 13:05:14 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Read error: Connection reset by peer) |
2024-11-20 13:06:09 +0100 | ethantwardy | (user@user/ethantwardy) (Ping timeout: 260 seconds) |
2024-11-20 13:10:38 +0100 | ethantwardy | (user@user/ethantwardy) ethantwardy |
2024-11-20 13:11:31 +0100 | alp_ | (~alp@2001:861:8ca0:4940:97d6:816b:8add:3996) (Ping timeout: 252 seconds) |
2024-11-20 13:13:11 +0100 | mari-estel | (~mari-este@user/mari-estel) (Ping timeout: 255 seconds) |
2024-11-20 13:19:58 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 245 seconds) |
2024-11-20 13:20:53 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 13:21:50 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en) |
2024-11-20 13:21:50 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-11-20 13:22:55 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 13:27:00 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) lortabac |
2024-11-20 13:32:00 +0100 | SlackCoder | (~SlackCode@64-94-63-8.ip.weststar.net.ky) (Quit: Leaving) |
2024-11-20 13:37:40 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43cc25887be993a47b.dip0.t-ipconnect.de) (Ping timeout: 272 seconds) |
2024-11-20 13:37:53 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43b9a67790c51d38b0.dip0.t-ipconnect.de) acidjnk |
2024-11-20 13:40:27 +0100 | ljdarj1 | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 13:41:17 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 13:43:10 +0100 | alp_ | (~alp@2001:861:8ca0:4940:f821:65d4:a88b:180b) |
2024-11-20 13:44:25 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 265 seconds) |
2024-11-20 13:44:26 +0100 | ljdarj1 | ljdarj |
2024-11-20 13:44:30 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 276 seconds) |
2024-11-20 13:45:39 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en |
2024-11-20 13:47:49 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Client Quit) |
2024-11-20 13:53:41 +0100 | Fijxu | (~Fijxu@user/fijxu) (Ping timeout: 255 seconds) |
2024-11-20 13:57:22 +0100 | lxsameer | (~lxsameer@Serene/lxsameer) (Ping timeout: 252 seconds) |
2024-11-20 13:57:38 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) (Remote host closed the connection) |
2024-11-20 14:00:06 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) TheCoffeMaker |
2024-11-20 14:01:01 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 14:02:53 +0100 | Digitteknohippie | (~user@user/digit) Digit |
2024-11-20 14:03:01 +0100 | Digit | (~user@user/digit) (Ping timeout: 244 seconds) |
2024-11-20 14:10:35 +0100 | vanishingideal | (~vanishing@user/vanishingideal) (Quit: leaving) |
2024-11-20 14:14:31 +0100 | <bwe> | dminuoso: hm, constraint depends on dual which is now deprecated and there is a break using current GHC 9.10.1. |
2024-11-20 14:15:28 +0100 | <bwe> | dminuoso: wait. It's weird. Why is GHC telling me that while hackage doesn't list dual as dependency? |
2024-11-20 14:16:01 +0100 | <bwe> | ah, it's constraintS not constraint. |
2024-11-20 14:27:22 +0100 | alp_ | (~alp@2001:861:8ca0:4940:f821:65d4:a88b:180b) (Remote host closed the connection) |
2024-11-20 14:27:39 +0100 | alp_ | (~alp@2001:861:8ca0:4940:b086:6e29:f872:e211) |
2024-11-20 14:28:42 +0100 | SlackCoder | (~SlackCode@64-94-63-8.ip.weststar.net.ky) SlackCoder |
2024-11-20 14:29:21 +0100 | mari-estel | (~mari-este@user/mari-estel) mari-estel |
2024-11-20 14:29:34 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 260 seconds) |
2024-11-20 14:35:45 +0100 | Pozyomka | (~pyon@user/pyon) (Ping timeout: 248 seconds) |
2024-11-20 14:36:45 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
2024-11-20 14:37:22 +0100 | alp_ | (~alp@2001:861:8ca0:4940:b086:6e29:f872:e211) (Remote host closed the connection) |
2024-11-20 14:37:39 +0100 | alp_ | (~alp@2001:861:8ca0:4940:53c2:f590:3f4e:6591) |
2024-11-20 14:43:07 +0100 | kuribas | (~user@ip-188-118-57-242.reverse.destiny.be) kuribas |
2024-11-20 14:43:22 +0100 | euleritian | (~euleritia@dynamic-176-003-034-243.176.3.pool.telefonica.de) |
2024-11-20 14:44:34 +0100 | euleritian | (~euleritia@dynamic-176-003-034-243.176.3.pool.telefonica.de) (Read error: Connection reset by peer) |
2024-11-20 14:44:51 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 14:47:34 +0100 | Fijxu | (~Fijxu@user/fijxu) fijxu |
2024-11-20 14:54:56 +0100 | ubert | (~Thunderbi@178.115.41.15.wireless.dyn.drei.com) (Ping timeout: 272 seconds) |
2024-11-20 14:55:12 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 246 seconds) |
2024-11-20 14:55:33 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 14:56:32 +0100 | weary-traveler | (~user@user/user363627) user363627 |
2024-11-20 14:58:03 +0100 | ubert | (~Thunderbi@178.115.41.15.wireless.dyn.drei.com) ubert |
2024-11-20 15:02:47 +0100 | son0p | (~ff@2800:e6:4001:6cc3:2748:5c2a:65d9:57ac) son0p |
2024-11-20 15:05:04 +0100 | Guest96 | (~Guest96@2402:3a80:9e:5890:e83f:36b9:abb4:3cb8) |
2024-11-20 15:05:17 +0100 | Guest96 | (~Guest96@2402:3a80:9e:5890:e83f:36b9:abb4:3cb8) (Client Quit) |
2024-11-20 15:07:39 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.4.2) |
2024-11-20 15:17:16 +0100 | stiell_ | (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
2024-11-20 15:17:39 +0100 | stiell_ | (~stiell@gateway/tor-sasl/stiell) stiell |
2024-11-20 15:18:27 +0100 | CiaoSen | (~Jura@2a05:5800:211:4200:ca4b:d6ff:fec1:99da) CiaoSen |
2024-11-20 15:36:17 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 255 seconds) |
2024-11-20 15:38:16 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 15:38:43 +0100 | CiaoSen | (~Jura@2a05:5800:211:4200:ca4b:d6ff:fec1:99da) (Ping timeout: 245 seconds) |
2024-11-20 15:41:27 +0100 | ljdarj1 | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 15:41:29 +0100 | lortabac | (~lortabac@37.166.62.73) lortabac |
2024-11-20 15:44:01 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 248 seconds) |
2024-11-20 15:44:02 +0100 | ljdarj1 | ljdarj |
2024-11-20 15:44:17 +0100 | divya | (~user@139.5.11.231) divya |
2024-11-20 15:49:50 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en |
2024-11-20 15:51:35 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 255 seconds) |
2024-11-20 15:51:47 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 15:55:26 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-11-20 15:56:17 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 15:57:37 +0100 | alp_ | (~alp@2001:861:8ca0:4940:53c2:f590:3f4e:6591) (Ping timeout: 252 seconds) |
2024-11-20 16:01:44 +0100 | Digitteknohippie | (~user@user/digit) (Ping timeout: 260 seconds) |
2024-11-20 16:11:35 +0100 | Digit | (~user@user/digit) Digit |
2024-11-20 16:12:44 +0100 | SlackCoder | (~SlackCode@64-94-63-8.ip.weststar.net.ky) (Quit: Leaving) |
2024-11-20 16:26:13 +0100 | mari-estel | (~mari-este@user/mari-estel) (Ping timeout: 252 seconds) |
2024-11-20 16:34:22 +0100 | lortabac | (~lortabac@37.166.62.73) (Ping timeout: 272 seconds) |
2024-11-20 16:36:47 +0100 | mari-estel | (~mari-este@user/mari-estel) mari-estel |
2024-11-20 16:37:37 +0100 | <bwe> | dminuoso: How close am I to the solution? https://paste.tomsmeding.com/kSbnWM3t |
2024-11-20 16:39:47 +0100 | Angelz | (Angelz@2605:6400:30:fc15:9bd1:2217:41cd:bb15) (Changing host) |
2024-11-20 16:39:47 +0100 | Angelz | (Angelz@user/angelz) angelz |
2024-11-20 16:40:20 +0100 | <dminuoso> | bwe: A bit far away. With constraints, instead of carrying a proxy around, you'd pass just a Dict around. |
2024-11-20 16:40:34 +0100 | <dminuoso> | (I mean you could conceive situations where you might want both, too) |
2024-11-20 16:48:14 +0100 | <bwe> | dminuoso: ok, so Dict replaces in my case simply Proxy. So, therefore also in the instances: https://play-haskell.tomsmeding.com/saved/zCSNq6hE |
2024-11-20 16:48:47 +0100 | <dminuoso> | bwe: This looks still wrong, |
2024-11-20 16:49:43 +0100 | <dminuoso> | withDict :: HasDict c e => e -> (c => r) -> r |
2024-11-20 16:50:14 +0100 | <dminuoso> | So the idea is to use it like this: `withDict e (fromHTML html)` |
2024-11-20 16:50:38 +0100 | <dminuoso> | fromHTML then does not take any Dict argument. |
2024-11-20 16:50:44 +0100 | <dminuoso> | Imagine this: |
2024-11-20 16:51:07 +0100 | <dminuoso> | :t fmap (+ (1 :: Int)) |
2024-11-20 16:51:07 +0100 | <lambdabot> | Functor f => f Int -> f Int |
2024-11-20 16:51:13 +0100 | <dminuoso> | Note that this function takes a constraint. |
2024-11-20 16:51:30 +0100 | <bwe> | (c => r) |
2024-11-20 16:51:52 +0100 | <dminuoso> | bwe: If you squint a bit, => is really not too different from -> |
2024-11-20 16:52:22 +0100 | <dminuoso> | We can pretend the constraint to be a kind of argument that needs to be provided. |
2024-11-20 16:52:34 +0100 | <dminuoso> | Except that GHC just automgically fills this, normally. |
2024-11-20 16:52:56 +0100 | <dminuoso> | `constraints` gives you a way to reify a dictionary, pass it around, and then discharge a constraint with it. |
2024-11-20 16:53:02 +0100 | <dminuoso> | by "discharge" I mean like function application. |
2024-11-20 16:53:20 +0100 | <dminuoso> | take something that wants a dictionary, and stuff the dictionary in to satisfy everything. |
2024-11-20 16:53:51 +0100 | SlackCoder | (~SlackCode@208.26.70.132) SlackCoder |
2024-11-20 16:54:04 +0100 | <bwe> | so, where do I stuff the dictionary? line 24 `fromDBEntry :: Dict (IntoGeneral a)` is that fine so far? |
2024-11-20 16:54:50 +0100 | <dminuoso> | % class Foo where f :: Int |
2024-11-20 16:54:50 +0100 | <yahb2> | <no output> |
2024-11-20 16:54:53 +0100 | <dminuoso> | % :t f |
2024-11-20 16:54:53 +0100 | <yahb2> | f :: Foo => Int |
2024-11-20 16:55:02 +0100 | <dminuoso> | bwe: See this? |
2024-11-20 16:55:17 +0100 | <dminuoso> | Or maybe this: |
2024-11-20 16:55:27 +0100 | <dminuoso> | % class Foo a where f :: Int |
2024-11-20 16:55:27 +0100 | <yahb2> | <interactive>:77:19: error: [GHC-39999] ; • Could not deduce ‘Foo a0’ ; from the context: Foo a ; bound by the type signature for: ; f :: forall {k} (a :: k). F... |
2024-11-20 16:55:30 +0100 | <dminuoso> | % class Bar a where f :: Int |
2024-11-20 16:55:30 +0100 | <yahb2> | <interactive>:79:19: error: [GHC-39999] ; • Could not deduce ‘Bar a0’ ; from the context: Bar a ; bound by the type signature for: ; f :: forall {k} (a :: k). B... |
2024-11-20 16:56:58 +0100 | <bwe> | so the type instance does carry its class with it |
2024-11-20 16:57:23 +0100 | <bwe> | so I actually put `Foo => Int` into `(c => r)` |
2024-11-20 16:57:26 +0100 | <dminuoso> | % :set -XAllowAmbiguousTypes |
2024-11-20 16:57:27 +0100 | <yahb2> | <no output> |
2024-11-20 16:57:28 +0100 | <dminuoso> | % class Bar a where f :: Int |
2024-11-20 16:57:28 +0100 | <yahb2> | <no output> |
2024-11-20 16:57:30 +0100 | <dminuoso> | Here we go. |
2024-11-20 16:57:33 +0100 | <dminuoso> | :t f |
2024-11-20 16:57:34 +0100 | <lambdabot> | FromExpr a => a |
2024-11-20 16:57:42 +0100 | <dminuoso> | % :t f |
2024-11-20 16:57:42 +0100 | <yahb2> | f :: forall {k} (a :: k). Bar a => Int |
2024-11-20 16:57:54 +0100 | <dminuoso> | bwe: Right. |
2024-11-20 16:58:06 +0100 | <dminuoso> | bwe: Or in this case `Bar a => Int` |
2024-11-20 16:58:20 +0100 | <bwe> | withDict :: e -> (Bar a => Int) -> Int |
2024-11-20 16:58:31 +0100 | <dminuoso> | bwe: You can then use DataKinds to promote SiteVariant too, that way you dont need separate `SiteA` and `SiteB` types. |
2024-11-20 16:58:32 +0100 | <bwe> | so what's `e` then? |
2024-11-20 16:59:12 +0100 | <bwe> | dminuoso: first I want to grasp `withDict` :) |
2024-11-20 16:59:13 +0100 | <dminuoso> | bwe: Lets pretend withDict :: Dict c -> (c => r) -> r |
2024-11-20 16:59:18 +0100 | <dminuoso> | Which is the simpler form. |
2024-11-20 16:59:33 +0100 | <dminuoso> | (And in fact there exists an instance that allows you to use it as such) |
2024-11-20 17:00:11 +0100 | <dminuoso> | "Assuming we have a reified dictionary for constraint c, and some r that needs a dictionary c, this discharges the `c =>` constraint and gives you the r back. |
2024-11-20 17:00:12 +0100 | <bwe> | withDict :: Dict (Bar a) -> (Bar a => Int) -> Int |
2024-11-20 17:00:24 +0100 | <dminuoso> | Yup, thats it. |
2024-11-20 17:01:10 +0100 | <bwe> | now it clicks. Dict __(Bar a) -> (__Bar a__ => Int) -> Int |
2024-11-20 17:01:11 +0100 | <dminuoso> | bwe: Under the hood `C =>` becomes really just some sort of function argument that takes a some actual dictionary. |
2024-11-20 17:01:36 +0100 | <dminuoso> | Except all that dictionary passing happens just invisibly and automatically under the hood. |
2024-11-20 17:01:44 +0100 | <dminuoso> | With `constraints` you make it explicit and controllable |
2024-11-20 17:01:45 +0100 | <bwe> | Whatever Dict carries, withDict discharges from the second argument |
2024-11-20 17:01:56 +0100 | <dminuoso> | Exactly. Its really just like function application |
2024-11-20 17:01:59 +0100 | <dminuoso> | :t ($) |
2024-11-20 17:02:00 +0100 | <lambdabot> | (a -> b) -> a -> b |
2024-11-20 17:02:05 +0100 | <dminuoso> | :t flip ($) |
2024-11-20 17:02:06 +0100 | <lambdabot> | a -> (a -> c) -> c |
2024-11-20 17:02:09 +0100 | <dminuoso> | Its pretty much the same thing. :) |
2024-11-20 17:02:24 +0100 | <bwe> | so how to apply this now… |
2024-11-20 17:03:15 +0100 | <dminuoso> | bwe: So first, get rid of SiteA and SiteB datatypes. |
2024-11-20 17:03:33 +0100 | <dminuoso> | bwe: Then flip on DataKinds, this way you suddenly get these magic types `A` and `B` |
2024-11-20 17:03:41 +0100 | <dminuoso> | % :set -XDataKinds |
2024-11-20 17:03:41 +0100 | <yahb2> | <no output> |
2024-11-20 17:03:52 +0100 | <dminuoso> | % data SiteVariant = SiteA | SiteB |
2024-11-20 17:03:52 +0100 | <yahb2> | <no output> |
2024-11-20 17:03:56 +0100 | <dminuoso> | % :k SiteA |
2024-11-20 17:03:56 +0100 | <yahb2> | SiteA :: SiteVariant |
2024-11-20 17:05:15 +0100 | <bwe> | https://play-haskell.tomsmeding.com/saved/M98rHWtW |
2024-11-20 17:05:37 +0100 | <bwe> | is DataKinds just using the type as a type and not to carry its value? |
2024-11-20 17:05:38 +0100 | alp_ | (~alp@2001:861:8ca0:4940:fc9d:90cc:a5de:4f14) |
2024-11-20 17:06:29 +0100 | <dminuoso> | bwe: DataKind promotes `SiteVariant` into a Kind, and conjures types `SiteA :: SiteVariant` and `SiteB :: SiteVariant` |
2024-11-20 17:07:55 +0100 | <bwe> | (while `SiteA` and `SiteB` continue to exist on the data level, too) |
2024-11-20 17:07:59 +0100 | <dminuoso> | Right. |
2024-11-20 17:08:19 +0100 | <bwe> | ay, what's next? |
2024-11-20 17:08:38 +0100 | <dminuoso> | So Im thinking maybe a HasDict instance. |
2024-11-20 17:08:58 +0100 | <dminuoso> | This is all getting really strange, at the end. |
2024-11-20 17:09:15 +0100 | <dminuoso> | Ultimately all you need is just `fromHTML :: SiteVariant -> ByteString -> General` of couerse. |
2024-11-20 17:09:56 +0100 | <bwe> | but this will be no more instance but normal function, right? |
2024-11-20 17:09:59 +0100 | <Square2> | I might get into the situation of making my department of 50 (12 devs) adapt Haskell. It's a bit scary tbh. How to onboard people who mostly programmed java past 15 years. |
2024-11-20 17:10:07 +0100 | <dminuoso> | bwe: Right. |
2024-11-20 17:10:50 +0100 | Alleria | (~Alleria@user/alleria) (Quit: Textual IRC Client: www.textualapp.com) |
2024-11-20 17:10:57 +0100 | <dminuoso> | Square2: Having onboarded a bunch of people onto Haskell, Id say it depends very much on the company culture and the people. |
2024-11-20 17:11:35 +0100 | <dminuoso> | bwe: I think we just ended up on a fun journey about constraints due to an XY problem. ;) |
2024-11-20 17:11:38 +0100 | <Square2> | dminuoso, Yeah, I feel it could be a uphill battle. Some are probably not up to it. |
2024-11-20 17:11:43 +0100 | <bwe> | dminuoso: so we drop withDict or not? |
2024-11-20 17:11:46 +0100 | <dminuoso> | Square2: Are they motivated to learn Haskell? |
2024-11-20 17:11:54 +0100 | <dminuoso> | bwe: Hey, we're just exploring for fun, right? |
2024-11-20 17:12:13 +0100 | <dminuoso> | You decide. :-) |
2024-11-20 17:12:15 +0100 | <bwe> | dminuoso: I am just before that fun bit :). |
2024-11-20 17:12:39 +0100 | <Square2> | dminuoso, Probably not. But most of them will just use it to write simple functions. All IO will remain in Java. |
2024-11-20 17:13:12 +0100 | <dminuoso> | Square2: If they are hardcore Java developers, not motivated to learn Haskell... Im not sure this is going to end well. |
2024-11-20 17:14:19 +0100 | <Square2> | dminuoso, I mean, they can probably see the motivation of using it. We're in a "there is no other way" situation. |
2024-11-20 17:14:36 +0100 | <dminuoso> | You can only lead a horse to the water. |
2024-11-20 17:14:43 +0100 | <bwe> | dminuoso: can we go back to complete the withDict first? I pretty much appreciate that DataKinds, though, later. |
2024-11-20 17:14:57 +0100 | <dminuoso> | With Haskell, there is a large portion about unlearning mindsets and learning new techniques, almost starting from scratch. |
2024-11-20 17:15:05 +0100 | <dminuoso> | bwe: Lets keep the DataKinds, though. |
2024-11-20 17:15:31 +0100 | <bwe> | dminuoso: here's the latest version: https://play-haskell.tomsmeding.com/saved/9jXIcvKT |
2024-11-20 17:16:16 +0100 | <bwe> | dminuoso: oh, I see, there's not too much difference in concepts with or without DataKinds |
2024-11-20 17:16:18 +0100 | <dminuoso> | bwe: So the idea is that with HasDict you can provide evidence for another constraint. |
2024-11-20 17:16:31 +0100 | <dminuoso> | bwe: Say you can attach evidence onto a SiteVariant for your HasGeneral constraint. |
2024-11-20 17:16:43 +0100 | <dminuoso> | bwe: Right, DataKinds just cleans it up. |
2024-11-20 17:16:53 +0100 | <dminuoso> | So you dont have both A and SiteA flying around. |
2024-11-20 17:17:15 +0100 | <bwe> | (I was scared for it to complicate things further.) |
2024-11-20 17:18:13 +0100 | <dminuoso> | Well, we're of course overcomplicating all of this. I did not know this was an XY problem yesterday. ;-) |
2024-11-20 17:18:29 +0100 | <dminuoso> | Might as well go all-in! |
2024-11-20 17:18:31 +0100 | <bwe> | Yeah, I had that gut feeling already. |
2024-11-20 17:18:42 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 272 seconds) |
2024-11-20 17:19:23 +0100 | <dminuoso> | bwe: So if you bring your HasGeneral typeclass back, make instances for `HasGeneral SiteA` and `HasGeneral SiteB` |
2024-11-20 17:19:30 +0100 | <Square2> | dminuoso, Yes, I've been there. But, yeah. To begin with, they'll only need to grasp basic functor/monad constructs. I feel it should be doable for people who got MSc's in comp science. |
2024-11-20 17:19:46 +0100 | <dminuoso> | Square2: My best advice, avoid the words `functor` and `monad`. |
2024-11-20 17:19:53 +0100 | <dminuoso> | Avoid the constructs entirely. |
2024-11-20 17:20:23 +0100 | ubert | (~Thunderbi@178.115.41.15.wireless.dyn.drei.com) (Remote host closed the connection) |
2024-11-20 17:20:31 +0100 | <Square2> | Not sure I can, but yeah I see your point. |
2024-11-20 17:20:37 +0100 | <mari-estel> | huh come on, functors are not that scary |
2024-11-20 17:20:42 +0100 | ubert | (~Thunderbi@178.115.41.15.wireless.dyn.drei.com) ubert |
2024-11-20 17:22:44 +0100 | <bwe> | dminuoso: https://play-haskell.tomsmeding.com/saved/Yl8rZptl |
2024-11-20 17:25:52 +0100 | <bwe> | dminuoso: `Dict (IntoGeneral a)` in the function head of `fromDBEntry` remains, because that is the dict for `withDict dict`? |
2024-11-20 17:26:47 +0100 | <bwe> | dminuoso: Do I have to define HasDict instances now? |
2024-11-20 17:28:02 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-11-20 17:29:44 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 17:30:33 +0100 | ljdarj | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 17:31:26 +0100 | <bwe> | I don't, because `withDict :: Dict c -> (c => r) -> r` is possible and `Dict (IntoGeneral a)` comes into play here… |
2024-11-20 17:32:44 +0100 | <bwe> | `withDict :: Dict (IntoGeneral a) -> (IntoGeneral a => SiteVariant) -> SiteVariant` |
2024-11-20 17:35:10 +0100 | <bwe> | dminuoso: still here? https://play-haskell.tomsmeding.com/saved/6PnEpvyR |
2024-11-20 17:38:28 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 252 seconds) |
2024-11-20 17:41:17 +0100 | img | (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in) |
2024-11-20 17:42:41 +0100 | img | (~img@user/img) img |
2024-11-20 17:45:45 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 17:49:20 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-11-20 17:50:25 +0100 | euleritian | (~euleritia@dynamic-176-004-009-213.176.4.pool.telefonica.de) |
2024-11-20 17:52:51 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 265 seconds) |
2024-11-20 17:58:35 +0100 | caconym | (~caconym@user/caconym) caconym |
2024-11-20 17:59:01 +0100 | SlackCoder | (~SlackCode@208.26.70.132) (Remote host closed the connection) |
2024-11-20 18:07:09 +0100 | euleritian | (~euleritia@dynamic-176-004-009-213.176.4.pool.telefonica.de) (Read error: Connection reset by peer) |
2024-11-20 18:08:01 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 18:09:59 +0100 | chele | (~chele@user/chele) (Remote host closed the connection) |
2024-11-20 18:14:27 +0100 | ljdarj | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 18:26:29 +0100 | son0p | (~ff@2800:e6:4001:6cc3:2748:5c2a:65d9:57ac) (Ping timeout: 252 seconds) |
2024-11-20 18:28:07 +0100 | Tuplanolla | (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) Tuplanolla |
2024-11-20 18:30:41 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en) |
2024-11-20 18:31:09 +0100 | forell | (~forell@user/forell) forell |
2024-11-20 18:31:31 +0100 | ljdarj1 | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 18:33:43 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43b9a67790c51d38b0.dip0.t-ipconnect.de) (Ping timeout: 245 seconds) |
2024-11-20 18:35:23 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 265 seconds) |
2024-11-20 18:35:23 +0100 | ljdarj1 | ljdarj |
2024-11-20 18:38:54 +0100 | chexum_ | (~quassel@gateway/tor-sasl/chexum) chexum |
2024-11-20 18:39:51 +0100 | _xor | (~xor@ip-66-42-132-175.dynamic.fuse.net) (Quit: brb/bbiab) |
2024-11-20 18:40:44 +0100 | <tomsmeding> | bwe: https://play-haskell.tomsmeding.com/saved/jPsc7ZTz ? |
2024-11-20 18:41:17 +0100 | <tomsmeding> | though `fromHTML (Proxy @SiteA) html` also works, why was the withDict there? |
2024-11-20 18:42:18 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 272 seconds) |
2024-11-20 18:42:35 +0100 | kuribas | (~user@ip-188-118-57-242.reverse.destiny.be) (Ping timeout: 255 seconds) |
2024-11-20 18:42:56 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 18:43:06 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 260 seconds) |
2024-11-20 18:43:58 +0100 | briandaed | (~root@user/briandaed) briandaed |
2024-11-20 18:48:51 +0100 | _xor | (~xor@ip-66-42-132-175.dynamic.fuse.net) _xor |
2024-11-20 18:50:19 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-11-20 18:53:51 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f43690414510db8e884.dip0.t-ipconnect.de) acidjnk |
2024-11-20 18:55:48 +0100 | ft | (~ft@p508dbc6e.dip0.t-ipconnect.de) ft |
2024-11-20 18:56:01 +0100 | Everything | (~Everythin@94.153.8.251) Everything |
2024-11-20 18:56:32 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 255 seconds) |
2024-11-20 18:56:58 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 18:57:20 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 260 seconds) |
2024-11-20 18:59:18 +0100 | lxsameer | (~lxsameer@Serene/lxsameer) lxsameer |
2024-11-20 19:02:41 +0100 | <bwe> | tomsmeding: yep, that's what I was after. thanks for the solution. |
2024-11-20 19:04:13 +0100 | <bwe> | tomsmeding: https://play-haskell.tomsmeding.com/saved/1d6dIp1u <- actually, if fromHTML generates `SiteVariant` inbetween on the way to produce `General`, I'd like `fromHTML` to return that, too, for debugging purposes. |
2024-11-20 19:05:12 +0100 | <bwe> | tomsmeding: withDict because not using DataKinds |
2024-11-20 19:05:23 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 245 seconds) |
2024-11-20 19:05:49 +0100 | <tomsmeding> | bwe: what do you mean with "because not using DataKinds"? |
2024-11-20 19:06:03 +0100 | euleritian | (~euleritia@dynamic-176-001-003-233.176.1.pool.telefonica.de) |
2024-11-20 19:06:06 +0100 | <tomsmeding> | bwe: the moment you write `IntoGeneral SiteA` you're using DataKinds |
2024-11-20 19:06:26 +0100 | <tomsmeding> | that SiteA there is in the position where a type is expected, but it's a data constructor; DataKinds lifts it to a type |
2024-11-20 19:07:02 +0100 | <bwe> | tomsmeding: yup, but I've started out using withDict before dminuoso proposed to switch to DataKinds |
2024-11-20 19:07:06 +0100 | <tomsmeding> | a type that has no values (because it's not a type of kind Type), hence you can't ask for a value of it in the type of fromHTML |
2024-11-20 19:07:32 +0100 | <tomsmeding> | I see, I haven't followed the discussion, just saw your last post :) |
2024-11-20 19:07:48 +0100 | euleritian | (~euleritia@dynamic-176-001-003-233.176.1.pool.telefonica.de) (Read error: Connection reset by peer) |
2024-11-20 19:08:02 +0100 | <tomsmeding> | bwe: that 'a' return value from fromHTML is suspect |
2024-11-20 19:08:03 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 19:08:09 +0100 | <tomsmeding> | how are you going to create a SiteA? |
2024-11-20 19:08:19 +0100 | <tomsmeding> | a _value of type SiteA_, to be precise? |
2024-11-20 19:08:33 +0100 | <bwe> | so, I had three initiations recently: Proxy, Constraints / withDict and DataKinds |
2024-11-20 19:09:22 +0100 | <tomsmeding> | ah with your latest paste, GHC complains as I expect |
2024-11-20 19:09:31 +0100 | <tomsmeding> | SiteA is not a type of kind Type |
2024-11-20 19:09:57 +0100 | <bwe> | tomsmeding: https://play-haskell.tomsmeding.com/saved/dfb9mlT9 |
2024-11-20 19:10:10 +0100 | <tomsmeding> | how are you going to write initSiteA? |
2024-11-20 19:10:14 +0100 | <tomsmeding> | that function has no definition |
2024-11-20 19:10:28 +0100 | <tomsmeding> | it is _impossible_ to write an initSiteA that is not undefined |
2024-11-20 19:10:57 +0100 | <tomsmeding> | if you want to return the _constructor_ SiteA instead, it should be initSiteA :: SiteVariant |
2024-11-20 19:11:35 +0100 | <bwe> | tomsmeding: You got me :). |
2024-11-20 19:11:43 +0100 | <bwe> | https://play-haskell.tomsmeding.com/saved/hi8Hh5MO |
2024-11-20 19:11:57 +0100 | <tomsmeding> | still an 'a' left in the return type of fromHTML |
2024-11-20 19:12:15 +0100 | <tomsmeding> | this doesn't typecheck |
2024-11-20 19:12:16 +0100 | <bwe> | so that will be then SiteVariant |
2024-11-20 19:12:33 +0100 | <tomsmeding> | (if you're posting playground snippets, you can check them with a click on a button -- do so ;) ) |
2024-11-20 19:12:45 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en |
2024-11-20 19:13:54 +0100 | <tomsmeding> | bwe: are you perhaps confused because you actually intended to write `data SiteVariant = SiteA SiteA | SiteB SiteB`? |
2024-11-20 19:13:59 +0100 | <tomsmeding> | where SiteA and SiteB are actual data types with fields |
2024-11-20 19:15:44 +0100 | tzh | (~tzh@c-76-115-131-146.hsd1.or.comcast.net) tzh |
2024-11-20 19:16:02 +0100 | <bwe> | so reversing DataKinds for a moment: https://play-haskell.tomsmeding.com/saved/eaWYsjTO |
2024-11-20 19:16:57 +0100 | <bwe> | (it's not compiling, ofc) |
2024-11-20 19:18:20 +0100 | <tomsmeding> | bwe: this is getting closer, but something else is still off: in fromDBEntry, you're deciding which variant to return based on siteVariant from the DBEntry, but the _type_ you hvae to return, 'a', is from that Dict (IntoGeneral a) argument |
2024-11-20 19:18:49 +0100 | <tomsmeding> | so this ain't going to work: _you_ want to choose, based on a value inside the DBEntry, what 'a' is, but the type signature of fromDBEntry allows the caller of fromDBEntry to choose 'a' |
2024-11-20 19:19:01 +0100 | Unicorn_Princess | (~Unicorn_P@user/Unicorn-Princess/x-3540542) Unicorn_Princess |
2024-11-20 19:19:17 +0100 | <bwe> | https://play-haskell.tomsmeding.com/saved/TXQ84gHu |
2024-11-20 19:19:29 +0100 | <tomsmeding> | same problem |
2024-11-20 19:19:34 +0100 | <tomsmeding> | the caller is allowed to choose a1 |
2024-11-20 19:19:54 +0100 | <tomsmeding> | you could give Variant and DBEntry a type argument indicating what the variant is for (SiteA or SiteB) |
2024-11-20 19:20:09 +0100 | <tomsmeding> | then the return type of fromDBEntry is linked to the _value_ inside the DBEntry |
2024-11-20 19:20:39 +0100 | <bwe> | that would be type level programming, correct? |
2024-11-20 19:20:52 +0100 | <tomsmeding> | no |
2024-11-20 19:21:04 +0100 | <tomsmeding> | well, not really |
2024-11-20 19:21:16 +0100 | <tomsmeding> | what is the X problem here (as in X-Y problem) :p |
2024-11-20 19:21:23 +0100 | <tomsmeding> | where does DBEntry come from? |
2024-11-20 19:21:29 +0100 | <tomsmeding> | what is the context? |
2024-11-20 19:22:03 +0100 | <tomsmeding> | there are various ways something _like_ this can typecheck, but they all result in different designs of the program |
2024-11-20 19:22:09 +0100 | <bwe> | oh, storing multiple pages of different websites to a DB, differentiated by Variant |
2024-11-20 19:22:31 +0100 | <tomsmeding> | right, so you're getting untyped data from the database, and you want to "create" more typing info? |
2024-11-20 19:22:50 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 244 seconds) |
2024-11-20 19:23:25 +0100 | <bwe> | then loading that from DB, channelling it into different parsing machinery depending on `Variant`, which eventually culminates into `General` which is abstract, again |
2024-11-20 19:23:44 +0100 | <bwe> | are we getting closer to X of XY :) ? |
2024-11-20 19:25:32 +0100 | <tomsmeding> | bwe: what about a low-tech option? https://play-haskell.tomsmeding.com/saved/au6S9SPc |
2024-11-20 19:26:10 +0100 | <tomsmeding> | just make a new sum type with the possible pages inside |
2024-11-20 19:26:13 +0100 | ljdarj1 | (~Thunderbi@user/ljdarj) ljdarj |
2024-11-20 19:28:05 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-11-20 19:29:33 +0100 | <tomsmeding> | if you want to invent type information that did not exist beforehand, you'll need an existential wrapper around the result to allow the function to choose the type, not the caller |
2024-11-20 19:29:33 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 244 seconds) |
2024-11-20 19:29:33 +0100 | ljdarj1 | ljdarj |
2024-11-20 19:29:43 +0100 | <tomsmeding> | but I suspect this is good enough for you |
2024-11-20 19:30:29 +0100 | <probie> | bwe: I haven't quite been following what you're trying to do, but could https://play-haskell.tomsmeding.com/saved/gnOyTnbR work? |
2024-11-20 19:30:31 +0100 | <bwe> | thumbs up :) |
2024-11-20 19:30:47 +0100 | <tomsmeding> | right, that's one way of encoding that existential lol |
2024-11-20 19:31:22 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en) |
2024-11-20 19:31:42 +0100 | euleritian | (~euleritia@dynamic-176-006-139-078.176.6.pool.telefonica.de) |
2024-11-20 19:32:04 +0100 | <tomsmeding> | probie: but given the methods of the IntoGeneral class, I don't feel like an implementation of that continuation could do much more than with the untyped version |
2024-11-20 19:32:32 +0100 | <tomsmeding> | sometimes simple is better :) |
2024-11-20 19:32:35 +0100 | <bwe> | so what's the buzz about the forall? |
2024-11-20 19:32:56 +0100 | <tomsmeding> | that forall in probie's version means that the caller has to pass fromDBEntry a function that works for _any_ a |
2024-11-20 19:33:05 +0100 | <tomsmeding> | hence fromDBEntry can choose what that 'a' is going to be |
2024-11-20 19:33:18 +0100 | Square | (~Square@user/square) Square |
2024-11-20 19:33:44 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en |
2024-11-20 19:33:50 +0100 | <tomsmeding> | (and then fromDBEntry just returns whatever that function returns, of type 'r') |
2024-11-20 19:34:25 +0100 | <tomsmeding> | this is one way of encoding an existential in haskell; the other is using a data type that wraps the existential inside |
2024-11-20 19:35:15 +0100 | <tomsmeding> | but given the functions you're writing here, I don't think the additional typing gives you much, because when you get that (a, General), you still don't know what 'a' is, so you'll have to do something to figure that out |
2024-11-20 19:35:36 +0100 | <tomsmeding> | and with my untyped version, you also don't know what kind of site you're getting, but at least you can easily figure out by checking whether it's an SVA or an SVB |
2024-11-20 19:35:42 +0100 | <bwe> | let that sink in |
2024-11-20 19:35:55 +0100 | <tomsmeding> | existentials are awkward in haskell, and they're usually not what you need |
2024-11-20 19:36:02 +0100 | <tomsmeding> | but they exist for the times when you do |
2024-11-20 19:36:06 +0100 | <bwe> | tomsmeding: so, avoid whenever possible forall? |
2024-11-20 19:36:18 +0100 | <tomsmeding> | well there's implicit foralls on many haskell functions ;) |
2024-11-20 19:36:20 +0100 | <tomsmeding> | % :t map |
2024-11-20 19:36:20 +0100 | <yahb2> | map :: (a -> b) -> [a] -> [b] |
2024-11-20 19:36:24 +0100 | <tomsmeding> | % :set -fprint-explicit-foralls |
2024-11-20 19:36:24 +0100 | <yahb2> | <no output> |
2024-11-20 19:36:26 +0100 | <tomsmeding> | % :t map |
2024-11-20 19:36:26 +0100 | <yahb2> | map :: forall a b. (a -> b) -> [a] -> [b] |
2024-11-20 19:36:56 +0100 | <tomsmeding> | it's the foralls inside argument types that bring you in RankNTypes land |
2024-11-20 19:37:02 +0100 | <bwe> | tomsmeding: and the SiteVariant with SVA and SVBs got introduced by you to return a single type with fromDBEntry (instead of SiteA, SiteB different types |
2024-11-20 19:37:08 +0100 | <tomsmeding> | exactly |
2024-11-20 19:37:17 +0100 | <bwe> | tomsmeding: so avoid or not avoid foralls is the question |
2024-11-20 19:37:19 +0100 | <tomsmeding> | the caller has to know what they get back from fromDBEntry |
2024-11-20 19:37:24 +0100 | Square2 | (~Square4@user/square) (Ping timeout: 260 seconds) |
2024-11-20 19:37:36 +0100 | <bwe> | btw how persistent is your paste? |
2024-11-20 19:37:41 +0100 | <tomsmeding> | I'd say, avoid explicit 'forall' for now, as you're learning |
2024-11-20 19:37:41 +0100 | euleritian | (~euleritia@dynamic-176-006-139-078.176.6.pool.telefonica.de) (Read error: Connection reset by peer) |
2024-11-20 19:37:52 +0100 | <tomsmeding> | persistent |
2024-11-20 19:37:55 +0100 | <bwe> | tomsmeding, dminuoso, probie: thanks for your support! |
2024-11-20 19:37:59 +0100 | euleritian | (~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) |
2024-11-20 19:38:57 +0100 | <tomsmeding> | I use foralls daily, so I'm not going to say "avoid foralls" -- but I don't think you need them yet :p |