Logs: liberachat/#haskell
| 2021-06-27 18:52:45 | <boxscape> | interestingly giving the type to the argument instead of to the entire lambda expression does not |
| 2021-06-27 18:53:02 | <safinaskar> | my code fails even if i enable ImpredicativeTypes (tested with 9.2.0.20210422 [latest available in ghcup]) |
| 2021-06-27 18:53:44 | × | tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2021-06-27 18:54:01 | <boxscape> | your code wouldn't work even if ImpredicativeTypes could fix this because of https://gitlab.haskell.org/ghc/ghc/-/issues/20020 |
| 2021-06-27 18:54:34 | → | talismanick joins (~user@2601:644:8502:d700::f19d) |
| 2021-06-27 18:55:57 | → | notzmv joins (~zmv@user/notzmv) |
| 2021-06-27 19:02:06 | <safinaskar> | so? what to do? i want to have polymorphic binding in do. i. e. something like this: do { f :: (forall a. a -> Int) <- .....; ..... f 2 .....; ..... f "o" ..... } |
| 2021-06-27 19:02:12 | <safinaskar> | is this possible? |
| 2021-06-27 19:02:59 | <qrpnxz> | safinaskar, i think you can do it with let but not with <- |
| 2021-06-27 19:04:34 | wroathe_ | is now known as wroathe |
| 2021-06-27 19:06:30 | <boxscape> | (Oh, right, my example worked because I forgot the parentheses around (forall a . [[a]])...) |
| 2021-06-27 19:06:32 | → | LukeHoersten joins (~LukeHoers@user/lukehoersten) |
| 2021-06-27 19:07:50 | × | jess quits (~jess@libera/staff/jess) () |
| 2021-06-27 19:07:53 | → | tungki joins (~Guest54@subs31-116-206-15-16.three.co.id) |
| 2021-06-27 19:09:30 | → | Meh joins (~Meh@202.14.120.46) |
| 2021-06-27 19:09:55 | Meh | is now known as Guest1495 |
| 2021-06-27 19:12:08 | <safinaskar> | ok, thanks |
| 2021-06-27 19:12:59 | × | Axman6 quits (~Axman6@user/axman6) (Ping timeout: 256 seconds) |
| 2021-06-27 19:13:06 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-06-27 19:13:28 | <boxscape> | safinaskar: something like this works https://paste.tomsmeding.com/DpnTBwVd |
| 2021-06-27 19:13:58 | <dminuoso> | boxscape: you should even be able to pattern match on the do-bind, no? |
| 2021-06-27 19:14:18 | <dminuoso> | Or does this run into the same bug you reported? |
| 2021-06-27 19:14:27 | <dminuoso> | I know we talked about this a few days ago, but I cant recall the details |
| 2021-06-27 19:14:35 | <boxscape> | dminuoso: no, you're right |
| 2021-06-27 19:14:46 | <boxscape> | it works |
| 2021-06-27 19:15:05 | <dminuoso> | Then you dont even need impredicative types anymore |
| 2021-06-27 19:15:15 | → | sleym joins (~sleym@23.81.181.4) |
| 2021-06-27 19:16:30 | <qrpnxz> | what is an impredicative type |
| 2021-06-27 19:17:02 | <boxscape> | qrpnxz: if you have a type constructor like Maybe and you have a type with forall as an argument to it, e.g. `Maybe (forall a . a -> a)` |
| 2021-06-27 19:17:02 | <Profpatsch> | dminuoso: true |
| 2021-06-27 19:17:03 | <dminuoso> | qrpnxz: Take [forall a. a] for instance |
| 2021-06-27 19:17:15 | <Profpatsch> | dminuoso: though I think not all points are invalid |
| 2021-06-27 19:17:27 | <dminuoso> | qrpnxz: In impredicative types, this type is allowed and it is quantified over all types, including itself. |
| 2021-06-27 19:17:33 | <Profpatsch> | I mean Hickey is probably on a local maximum |
| 2021-06-27 19:17:34 | → | unyu joins (~pyon@user/pyon) |
| 2021-06-27 19:17:39 | <Profpatsch> | one that is pretty good |
| 2021-06-27 19:17:40 | <qrpnxz> | ah |
| 2021-06-27 19:17:49 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 268 seconds) |
| 2021-06-27 19:17:56 | <safinaskar> | boxscape: thanks. i tried to make Id type with kind (* -> * ): https://godbolt.org/z/YhcjvP41x . and now code doesn't compile |
| 2021-06-27 19:18:05 | × | Guest1495 quits (~Meh@202.14.120.46) (Quit: Connection closed) |
| 2021-06-27 19:18:07 | × | xff0x quits (~xff0x@2001:1a81:533e:6d00:c133:b997:3ccf:96a0) (Ping timeout: 250 seconds) |
| 2021-06-27 19:18:11 | → | kayprish joins (~kayprish@46.240.143.86) |
| 2021-06-27 19:18:16 | <safinaskar> | boxscape: so, this means i need to create special newtype for this particular binding?! |
| 2021-06-27 19:18:25 | <safinaskar> | boxscape: this is very ugly |
| 2021-06-27 19:18:45 | <dminuoso> | Profpatsch: Im not saying his points are invalid, just that the way he losely reasons mostly to accomodate an audience that claps and cheers at everything he says. :) |
| 2021-06-27 19:18:56 | <dminuoso> | is not a way that I care for |
| 2021-06-27 19:18:59 | → | xff0x joins (~xff0x@2001:1a81:533e:6d00:cffe:3614:284d:42ae) |
| 2021-06-27 19:20:06 | <dminuoso> | Rich convincing Clojure fans at Clojure Conj that the clojure way is the true way.. well. He summarized a series of SPJ talks in one and a half sentences, and just dismissed it as "he's totally wrong, we all know dynamic is better than static. QED." |
| 2021-06-27 19:20:21 | <boxscape> | safinaskar: hm I'm playing around with it but haven't found a better way yet that works |
| 2021-06-27 19:20:22 | <dminuoso> | (I paraphrased a bit) |
| 2021-06-27 19:21:03 | <Profpatsch> | yeah |
| 2021-06-27 19:21:23 | <boxscape> | safinaskar: never mind I have found a way, hold on |
| 2021-06-27 19:23:08 | <boxscape> | safinaskar: this _should_ work, but doesn't: https://paste.tomsmeding.com/tOKilQ57 That's because of the GHC issue I posted above. However, translating it into non-do notation _does_ work: https://paste.tomsmeding.com/BZFWmxK9 |
| 2021-06-27 19:23:36 | <boxscape> | safinaskar: the important thing being the type application @(forall a . a -> a), to let Id know that its argument is supposed to be polymorphic |
| 2021-06-27 19:24:12 | <dminuoso> | Profpatsch: The original topic is an interesting subject, I pondered quite a bit about it. At the end there's different audiences. In my experience, with the systems I work with, being absolutely strict with input is worth more than any hypothetical "forward compatibility" |
| 2021-06-27 19:24:21 | <dminuoso> | Especially when both the client and server are under your control |
| 2021-06-27 19:24:46 | <boxscape> | safinaskar: here's a shorter version that still works: https://paste.tomsmeding.com/OxAE9zhh |
| 2021-06-27 19:24:47 | <dminuoso> | Then be as strict as you can, since an unparsed field is likely an error on the sending side. |
| 2021-06-27 19:27:01 | <Profpatsch> | dminuoso: I think he conflates “not caring about whether something is there” with “providing defaults when something is not there” |
| 2021-06-27 19:27:03 | → | a6a45081-2b83 joins (~aditya@122.163.205.132) |
| 2021-06-27 19:27:45 | <dminuoso> | Judging from the contents its rather "why do I care what other things you send me. I just care about the values i look at" |
| 2021-06-27 19:27:47 | <dminuoso> | *context |
| 2021-06-27 19:28:01 | <dminuoso> | The true pinnacle of dynamic programming where all you fling around is lists and maps |
| 2021-06-27 19:28:30 | <Rembane> | And poo! |
| 2021-06-27 19:28:51 | <dminuoso> | To some extend I can understand his love of maps, since they are so nicely compositional. You can just plug values out, merge them together in new fancy ways |
| 2021-06-27 19:29:10 | <dminuoso> | The desire for this even in static type sytems can be found in row types research |
| 2021-06-27 19:29:47 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-27 19:30:47 | <boxscape> | that's the "structural vs nominal" divide rather than the "static vs dynamic" divide, isn't it? |
| 2021-06-27 19:30:53 | <dminuoso> | Right |
| 2021-06-27 19:30:57 | <dminuoso> | well yes and no |
| 2021-06-27 19:31:03 | × | sagax quits (~sagax@213.138.71.146) (Remote host closed the connection) |
| 2021-06-27 19:31:03 | <boxscape> | (not that you can't have both structural and nominal typing together) |
| 2021-06-27 19:31:15 | <dminuoso> | dynamic type systems are inherently nominal |
| 2021-06-27 19:31:48 | <Rembane> | Are there no structural dynamic typing systems? |
| 2021-06-27 19:31:55 | <Rembane> | *type |
| 2021-06-27 19:32:19 | → | ph88_ joins (~ph88@ip5f5af6fd.dynamic.kabel-deutschland.de) |
| 2021-06-27 19:32:21 | → | tromp joins (~textual@dhcp-077-249-230-040.chello.nl) |
| 2021-06-27 19:32:36 | <safinaskar> | boxscape: ok, thanks |
| 2021-06-27 19:33:56 | <boxscape> | I suppose checking whether the entire structure matches dynamically probably isn't worth the runtime cost compared to just checking whether the relevant structure matches, which gets you to duck typing |
| 2021-06-27 19:34:28 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 268 seconds) |
| 2021-06-27 19:34:52 | <Rembane> | Both sounds structurally typed to me, it's checked at runtime rather than compile time though. |
| 2021-06-27 19:35:53 | boxscape | shrugs |
| 2021-06-27 19:36:01 | <boxscape> | wikpedia distinguishes between structural and duck |
| 2021-06-27 19:36:19 | × | ph88^ quits (~ph88@2a02:8109:9e00:7e5c:6024:1b36:f949:e91) (Ping timeout: 268 seconds) |
| 2021-06-27 19:36:24 | <boxscape> | though I'm not sure why dynamic typing would be inherently nominal as dminuoso when duck typing exists... |
| 2021-06-27 19:36:29 | <boxscape> | s//said |
| 2021-06-27 19:37:49 | × | superbil quits (~superbil@1-34-176-171.HINET-IP.hinet.net) (Ping timeout: 268 seconds) |
| 2021-06-27 19:45:40 | → | eight joins (~eight@user/eight) |
| 2021-06-27 19:47:25 | × | tungki quits (~Guest54@subs31-116-206-15-16.three.co.id) (Ping timeout: 246 seconds) |
| 2021-06-27 19:47:31 | × | LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-06-27 19:48:21 | <boxscape> | Does it go back to the "dynamic type systems aren't actually type systems" thing? |
| 2021-06-27 19:49:16 | × | ph88_ quits (~ph88@ip5f5af6fd.dynamic.kabel-deutschland.de) (Ping timeout: 268 seconds) |
| 2021-06-27 19:52:30 | → | warnz joins (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f) |
| 2021-06-27 19:52:43 | → | fendor_ joins (~fendor@178.165.168.249.wireless.dyn.drei.com) |
| 2021-06-27 19:53:03 | fendor | is now known as fendor__ |
| 2021-06-27 19:53:07 | fendor_ | is now known as fendor |
| 2021-06-27 19:53:10 | fendor__ | is now known as fendor_ |
| 2021-06-27 19:54:19 | <safinaskar> | arguing about type systems? here another argument: in typescript (as well as i know) you can get empty list from function returning list of ints and pass it to function accepting list of strings |
| 2021-06-27 19:55:23 | <safinaskar> | i. e. you can do something like this haskell code: module X where { f :: [Int]; f = []; g :: [String] -> (); g _ = (); main = return $ g f; } |
| 2021-06-27 19:55:28 | <safinaskar> | in haskell this is impossible |
All times are in UTC.