Logs: freenode/#haskell
| 2020-10-26 16:05:23 | × | polyrain quits (~polyrain@2001:8003:e501:6901:15fa:5e4:342f:f38b) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-10-26 16:05:37 | <tomsmeding> | need some FlexibleContexts or similar, but I recall that may work |
| 2020-10-26 16:05:40 | <T0pH4t> | This compiles: class Foo a where type Bar a, toBaz :: Baz (Bar a) => a -> Bar |
| 2020-10-26 16:07:04 | <T0pH4t> | but if you try to use it, like "doStuff :: Baz a => a -> Int" , "doStuff (toBaz x) " where x is an instance of F |
| 2020-10-26 16:07:06 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 260 seconds) |
| 2020-10-26 16:07:07 | <T0pH4t> | Foo* |
| 2020-10-26 16:07:14 | × | texasmynsted quits (~texasmyns@99.96.221.112) (Remote host closed the connection) |
| 2020-10-26 16:07:21 | <T0pH4t> | it will not infer the Baz instance |
| 2020-10-26 16:07:27 | <T0pH4t> | for doStuff invoke |
| 2020-10-26 16:07:32 | <T0pH4t> | which in theory it should |
| 2020-10-26 16:07:56 | <T0pH4t> | or at least in my mind it should But apparently it wants the concrete |
| 2020-10-26 16:10:20 | <tomsmeding> | oh interesting, indeed it doesn't |
| 2020-10-26 16:10:25 | × | damianfral3 quits (~damianfra@25.red-176-87-152.dynamicip.rima-tde.net) (Ping timeout: 264 seconds) |
| 2020-10-26 16:10:27 | × | xff0x quits (~fox@2001:1a81:53e0:c700:e7ad:c450:afad:c09f) (Ping timeout: 272 seconds) |
| 2020-10-26 16:10:40 | <tomsmeding> | did you try the 'Baz (Bar a) =>' constraint on the class already? |
| 2020-10-26 16:10:43 | <tomsmeding> | T0pH4t: ^ |
| 2020-10-26 16:11:03 | → | xff0x joins (~fox@2001:1a81:53e0:c700:61cc:9558:5574:c70a) |
| 2020-10-26 16:11:34 | <T0pH4t> | oh that, no let me try |
| 2020-10-26 16:12:46 | <T0pH4t> | tomsmeding: that seems to be legal, thx! |
| 2020-10-26 16:13:26 | <tomsmeding> | the 'Baz (Bar a) =>' constraint on toBaz seems to go in the other direction: toBaz then _requires_ the caller to prove that Baz (Bar a), instead of _producing_ that information |
| 2020-10-26 16:13:46 | <tomsmeding> | as background why that didn't work |
| 2020-10-26 16:14:08 | <T0pH4t> | the toBaz was going to be a work around, the class constraint is better |
| 2020-10-26 16:14:22 | <T0pH4t> | but i am curious, i would have thought toBaz would work |
| 2020-10-26 16:14:25 | × | kuribas quits (~user@ptr-25vy0ialak9zgvszewg.18120a2.ip6.access.telenet.be) (Quit: ERC (IRC client for Emacs 26.3)) |
| 2020-10-26 16:14:38 | <T0pH4t> | assuming i only needed the Baz class contract |
| 2020-10-26 16:15:35 | → | geekosaur joins (82659a09@host154-009.vpn.uakron.edu) |
| 2020-10-26 16:15:44 | → | howdoi joins (uid224@gateway/web/irccloud.com/x-lyptkrhyywcfcsfh) |
| 2020-10-26 16:16:27 | <tomsmeding> | yes the class constraint is certainly better, but the toBaz workaround didn't work because the constraint on toBaz goes in the other direction |
| 2020-10-26 16:16:28 | × | chele quits (~chele@ip5b416ea2.dynamic.kabel-deutschland.de) (Remote host closed the connection) |
| 2020-10-26 16:16:39 | <T0pH4t> | i see, ok thx |
| 2020-10-26 16:17:01 | <T0pH4t> | i will need to think about that a bit more "other direction" |
| 2020-10-26 16:17:10 | × | cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 2.9) |
| 2020-10-26 16:17:14 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-26 16:18:35 | <tomsmeding> | T0pH4t: generally, when you have e.g. nub :: Eq a => [a] -> [a], the caller is supposed to prove that Eq a holds, right? |
| 2020-10-26 16:18:50 | <tomsmeding> | it doesn't magically appear because of using nub |
| 2020-10-26 16:18:57 | <T0pH4t> | right |
| 2020-10-26 16:18:59 | <tomsmeding> | same here with toBaz ;) |
| 2020-10-26 16:19:01 | <T0pH4t> | ah ok |
| 2020-10-26 16:19:03 | <T0pH4t> | thx |
| 2020-10-26 16:19:10 | <tomsmeding> | I was confused for a bit too |
| 2020-10-26 16:19:29 | × | DirefulSalt quits (DirefulSal@gateway/vpn/privateinternetaccess/direfulsalt) (Remote host closed the connection) |
| 2020-10-26 16:19:42 | × | phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 260 seconds) |
| 2020-10-26 16:19:54 | → | DirefulSalt joins (DirefulSal@gateway/vpn/privateinternetaccess/direfulsalt) |
| 2020-10-26 16:20:18 | <T0pH4t> | yeah, but assuming you called nub with something else "foo :: Eq a => [a] -> [a]" foo = nub |
| 2020-10-26 16:20:21 | <T0pH4t> | that should work |
| 2020-10-26 16:20:28 | <T0pH4t> | which is what i kind of thought i was doing |
| 2020-10-26 16:20:31 | <T0pH4t> | but maybe not |
| 2020-10-26 16:20:47 | × | raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 260 seconds) |
| 2020-10-26 16:20:50 | <tomsmeding> | oh |
| 2020-10-26 16:20:56 | <T0pH4t> | i gues that example isn't fully legit, more like "foo :: Eq a => [a]" then calling numb |
| 2020-10-26 16:20:58 | <T0pH4t> | nub* |
| 2020-10-26 16:21:01 | <T0pH4t> | which doesn't work :/ |
| 2020-10-26 16:21:05 | <tomsmeding> | indeed |
| 2020-10-26 16:21:10 | <tomsmeding> | heh |
| 2020-10-26 16:21:23 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-26 16:22:19 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2020-10-26 16:24:13 | <tomsmeding> | T0pH4t: but it does work: https://paste.tomsmeding.com/L29Apujl this compiles |
| 2020-10-26 16:24:25 | → | Saukk joins (~Saukk@2001:998:f9:2914:1c59:9bb5:b94c:4) |
| 2020-10-26 16:25:09 | <tomsmeding> | (note the Baz (Bar a) constraint on 'kaas') |
| 2020-10-26 16:25:46 | <tomsmeding> | (still the class constraint is better but we decided that already) |
| 2020-10-26 16:30:24 | <thblt> | I got my stupid little game working and I think I got a better understanding of how I can write "real" programs in hs. Thanks all :) |
| 2020-10-26 16:30:52 | <tomsmeding> | thblt: cheers! good luck :) |
| 2020-10-26 16:31:36 | × | motherfsck quits (~motherfsc@unaffiliated/motherfsck) (Quit: quit) |
| 2020-10-26 16:32:56 | <thblt> | Now to make acrobatic stack of monads. "If if doesn't work, just add one stacking level". |
| 2020-10-26 16:34:36 | <tomsmeding> | maybe you can conjure up an AbstractFactoryT |
| 2020-10-26 16:34:41 | <tomsmeding> | and a beanT |
| 2020-10-26 16:34:49 | <tomsmeding> | corr. BeanT |
| 2020-10-26 16:35:27 | <thblt> | HaskellEE |
| 2020-10-26 16:36:32 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:146b:c489:8b41:e2cb) |
| 2020-10-26 16:36:43 | <tomsmeding> | I suddenly see an alternative reverse-acronym for IEEE |
| 2020-10-26 16:37:08 | <ixlun> | ugh.. just killed GHC |
| 2020-10-26 16:37:24 | <ixlun> | it used up 30Gigs of RAM compiling :-( |
| 2020-10-26 16:38:18 | <thblt> | That's not polite. But I think GHC tends to overallocate? |
| 2020-10-26 16:38:28 | → | kish joins (~oracle@unaffiliated/oracle) |
| 2020-10-26 16:38:42 | <ixlun> | I think it's because I'm doing some TH |
| 2020-10-26 16:39:01 | <ixlun> | and I must have generated a monster data structure |
| 2020-10-26 16:39:10 | <monsterchrom> | :) |
| 2020-10-26 16:39:17 | <geekosaur> | generics? |
| 2020-10-26 16:39:34 | → | kish` joins (~oracle@unaffiliated/oracle) |
| 2020-10-26 16:40:18 | <ixlun> | geekosaur: Nah, static data generation |
| 2020-10-26 16:40:30 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds) |
| 2020-10-26 16:40:53 | × | jonathanx quits (~jonathan@dyn-8-sc.cdg.chalmers.se) (Remote host closed the connection) |
| 2020-10-26 16:40:59 | <ixlun> | I'm writing a chess engine and I get TH to generate all possible moves for every piece kind at every position on the board |
| 2020-10-26 16:41:20 | → | alx741 joins (~alx741@186.178.110.169) |
| 2020-10-26 16:41:58 | <ixlun> | Can I get a vector that's indexed by Word8? |
| 2020-10-26 16:42:07 | × | alp quits (~alp@2a01:e0a:58b:4920:c83a:4ff:4d6e:6312) (Ping timeout: 272 seconds) |
| 2020-10-26 16:42:10 | <ixlun> | rahter than Int |
| 2020-10-26 16:42:30 | <monsterchrom> | No. Use fromIntegral |
| 2020-10-26 16:42:34 | × | Saukk quits (~Saukk@2001:998:f9:2914:1c59:9bb5:b94c:4) (Remote host closed the connection) |
| 2020-10-26 16:42:45 | × | kish quits (~oracle@unaffiliated/oracle) (Ping timeout: 240 seconds) |
| 2020-10-26 16:42:45 | × | chkno quits (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) (Read error: Connection reset by peer) |
| 2020-10-26 16:42:57 | → | chkno joins (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-26 16:43:07 | <tomsmeding> | (or use Array) |
| 2020-10-26 16:46:05 | <ixlun> | If I use fromIntegral would GHC manage to optimise that out? |
| 2020-10-26 16:46:26 | × | brown121407 quits (~brown1214@fsf/member/brown121407) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2020-10-26 16:47:37 | <tomsmeding> | I think at the assembly level, assuming you're running on x86_64, it's going to be a 64-bit int anyway |
| 2020-10-26 16:47:54 | <tomsmeding> | or I guess 32, that will work too |
| 2020-10-26 16:48:21 | × | acidjnk_new quits (~acidjnk@p200300d0c7237822f9c109cfb48a3b3a.dip0.t-ipconnect.de) (Ping timeout: 244 seconds) |
| 2020-10-26 16:49:35 | <monsterchrom> | Optimizations depends on detailed actual code. Including your specific question. |
| 2020-10-26 16:51:54 | × | chkno quits (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
All times are in UTC.