Logs: liberachat/#haskell
| 2021-05-31 09:04:59 | × | berberman quits (~berberman@user/berberman) (Ping timeout: 268 seconds) |
| 2021-05-31 09:05:06 | × | cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.1) |
| 2021-05-31 09:05:37 | → | Guest417 joins (~winter@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com) |
| 2021-05-31 09:06:49 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:7549:f26f:981e:10ae) (Ping timeout: 268 seconds) |
| 2021-05-31 09:07:54 | <arahael> | Thanks :) |
| 2021-05-31 09:08:44 | → | xprlgjf joins (~gavin@60.27.93.209.dyn.plus.net) |
| 2021-05-31 09:09:54 | × | ubikium quits (~ubikium@113x43x248x70.ap113.ftth.arteria-hikari.net) (Ping timeout: 268 seconds) |
| 2021-05-31 09:10:14 | → | ubikium joins (~ubikium@2400:2200:4f2:4b71:94bf:c634:be62:7c0d) |
| 2021-05-31 09:12:23 | × | xprlgjf quits (~gavin@60.27.93.209.dyn.plus.net) (Remote host closed the connection) |
| 2021-05-31 09:13:19 | → | xprlgjf joins (~gavin@60.27.93.209.dyn.plus.net) |
| 2021-05-31 09:14:31 | × | ubikium quits (~ubikium@2400:2200:4f2:4b71:94bf:c634:be62:7c0d) (Read error: Connection reset by peer) |
| 2021-05-31 09:14:45 | → | ubikium joins (~ubikium@113x43x248x70.ap113.ftth.arteria-hikari.net) |
| 2021-05-31 09:20:13 | × | Topsi quits (~Tobias@dyndsl-095-033-095-132.ewe-ip-backbone.de) (Quit: Leaving.) |
| 2021-05-31 09:20:26 | → | Topsi joins (~Tobias@dyndsl-095-033-095-132.ewe-ip-backbone.de) |
| 2021-05-31 09:21:42 | → | guest0123 joins (~aaron@2601:602:a080:fa0:21da:7ddc:2cc6:a10c) |
| 2021-05-31 09:22:52 | × | Erutuon quits (~Erutuon@71-34-10-193.mpls.qwest.net) (Ping timeout: 268 seconds) |
| 2021-05-31 09:24:26 | × | xprlgjf quits (~gavin@60.27.93.209.dyn.plus.net) (Remote host closed the connection) |
| 2021-05-31 09:27:13 | × | Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt) |
| 2021-05-31 09:27:46 | × | holy_ quits (~h01y_b4z0@2400:adc1:178:c800:9e45:76a9:57f2:1665) (Ping timeout: 264 seconds) |
| 2021-05-31 09:28:38 | → | tomboy64 joins (~tomboy64@2a02:2454:416:db00:ba27:ebff:fe58:73c2) |
| 2021-05-31 09:29:23 | → | xprlgjf joins (~gavin@60.27.93.209.dyn.plus.net) |
| 2021-05-31 09:31:11 | → | fendor joins (~fendor@178.115.56.93.wireless.dyn.drei.com) |
| 2021-05-31 09:31:29 | × | shiraeeshi quits (~shiraeesh@109.166.58.176) (Ping timeout: 264 seconds) |
| 2021-05-31 09:31:29 | × | rahguzar quits (~rahguzar@dynamic-adsl-84-220-228-254.clienti.tiscali.it) (Ping timeout: 264 seconds) |
| 2021-05-31 09:33:59 | × | xkb quits (~xkb@a80-100-6-16.adsl.xs4all.nl) (Quit: Ping timeout (120 seconds)) |
| 2021-05-31 09:34:30 | × | jonathanclarke quits (~jonathanc@202.51.76.55) (Ping timeout: 264 seconds) |
| 2021-05-31 09:34:47 | → | guest531 joins (~user@49.5.6.87) |
| 2021-05-31 09:36:28 | → | disconsis joins (~disconsis@103.212.147.213) |
| 2021-05-31 09:36:42 | <disconsis> | hi guys |
| 2021-05-31 09:36:50 | <disconsis> | i'm trying to solve a sorta simple problem |
| 2021-05-31 09:37:12 | <tdammers> | sorta simple problems are the worst |
| 2021-05-31 09:37:21 | <disconsis> | I have an AstF type: |
| 2021-05-31 09:37:24 | <disconsis> | data AstF a b |
| 2021-05-31 09:37:26 | <disconsis> | = Assign { var :: Text, value :: ArithExpr, label :: a } |
| 2021-05-31 09:37:28 | <disconsis> | ... |
| 2021-05-31 09:37:57 | <disconsis> | I would assume that (Assign{ label :: a}) :: forall b . AstF a b |
| 2021-05-31 09:38:59 | <opqdonut> | I think the record update syntax might be monomorphic |
| 2021-05-31 09:39:49 | <disconsis> | I was trying to indicate that label has type 'a' |
| 2021-05-31 09:40:02 | <disconsis> | Sorry, that's not actual code |
| 2021-05-31 09:40:06 | <disconsis> | I'm trying to do this: |
| 2021-05-31 09:40:07 | → | shiraeeshi joins (~shiraeesh@109.166.58.176) |
| 2021-05-31 09:40:08 | <disconsis> | apply :: (i -> a -> (i, b)) -> i -> AstF a (Ast b) -> (i, AstF b (Ast b)) |
| 2021-05-31 09:40:10 | <disconsis> | apply f i ast = |
| 2021-05-31 09:40:12 | <disconsis> | let (i', label') = f i (label ast) |
| 2021-05-31 09:40:14 | <disconsis> | in (i', ast {label = label'}) |
| 2021-05-31 09:40:16 | <disconsis> | recurse :: (i -> a -> (i, b)) -> i -> Ast a -> (i, Ast b) |
| 2021-05-31 09:40:18 | <disconsis> | recurse f i = \case |
| 2021-05-31 09:40:20 | <disconsis> | Ast ast@Assign {..} -> apply f i ast |
| 2021-05-31 09:40:28 | <opqdonut> | oh nevermind I was reading the code all wrong anyway |
| 2021-05-31 09:40:43 | <disconsis> | Oh shit this is also relevat |
| 2021-05-31 09:40:45 | <disconsis> | newtype Ast a = Ast (AstF a (Ast a)) |
| 2021-05-31 09:40:46 | × | tomboy64 quits (~tomboy64@2a02:2454:416:db00:ba27:ebff:fe58:73c2) (Changing host) |
| 2021-05-31 09:40:46 | → | tomboy64 joins (~tomboy64@user/tomboy64) |
| 2021-05-31 09:41:02 | × | tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2021-05-31 09:41:15 | <disconsis> | Sorry this looks a bit complicated, but the basic problem is that in 'recurse', ast :: AstF a (Ast a) |
| 2021-05-31 09:41:30 | <disconsis> | But I'm trying to use it as a value of type AstF a (Ast b) |
| 2021-05-31 09:41:44 | <disconsis> | I feel like I should be able to do that, since the Assign constructor doesn't use 'b' |
| 2021-05-31 09:42:55 | <disconsis> | (there's a mistake here, it should really be `Ast ast@Assign {..} -> second Ast $ apply f i ast` in 'recurse') |
| 2021-05-31 09:43:09 | × | tomboy64 quits (~tomboy64@user/tomboy64) (Quit: Off to see the wizard.) |
| 2021-05-31 09:43:33 | <disconsis> | However, if I do ast' = ast { label = label } then I can use ast' as a value of type AstF a (Ast b) |
| 2021-05-31 09:43:35 | → | tomboy64 joins (~tomboy64@user/tomboy64) |
| 2021-05-31 09:44:00 | <disconsis> | This feels unneccessary to me. any way to fix this? |
| 2021-05-31 09:44:31 | × | lortabac quits (~lortabac@2a01:e0a:541:b8f0:c68c:4252:bd9f:2d01) (Ping timeout: 265 seconds) |
| 2021-05-31 09:44:42 | × | xprlgjf quits (~gavin@60.27.93.209.dyn.plus.net) (Remote host closed the connection) |
| 2021-05-31 09:45:02 | → | madnight joins (~madnight@static.59.103.201.195.clients.your-server.de) |
| 2021-05-31 09:45:10 | → | Dusk[m] joins (~bb010gmat@2001:470:69fc:105::9a5) |
| 2021-05-31 09:45:16 | Dusk[m] | is now known as bb010g |
| 2021-05-31 09:45:17 | → | tromp joins (~textual@dhcp-077-249-230-040.chello.nl) |
| 2021-05-31 09:46:20 | <disconsis> | In all, this is the code: |
| 2021-05-31 09:46:22 | <disconsis> | data AstF a b |
| 2021-05-31 09:46:24 | <disconsis> | = Assign { var :: Text, value :: ArithExpr, label :: a } |
| 2021-05-31 09:46:26 | <disconsis> | newtype Ast a = Ast (AstF a (Ast a)) |
| 2021-05-31 09:46:28 | <disconsis> | apply :: (i -> a -> (i, b)) -> i -> AstF a (Ast b) -> (i, AstF b (Ast b)) |
| 2021-05-31 09:46:30 | <disconsis> | apply f i ast = |
| 2021-05-31 09:46:32 | <disconsis> | let (i', label') = f i (label ast) |
| 2021-05-31 09:46:34 | <disconsis> | in (i', ast {label = label'}) |
| 2021-05-31 09:46:36 | <disconsis> | recurse :: (i -> a -> (i, b)) -> i -> Ast a -> (i, Ast b) |
| 2021-05-31 09:46:38 | <disconsis> | recurse f i = \case |
| 2021-05-31 09:46:38 | × | tomboy64 quits (~tomboy64@user/tomboy64) (Client Quit) |
| 2021-05-31 09:46:40 | <disconsis> | Ast ast@Assign {..} -> |
| 2021-05-31 09:46:42 | <disconsis> | -- second Ast $ apply f i ast -- doesn't work |
| 2021-05-31 09:46:44 | <disconsis> | second Ast $ apply f i (ast { var = var }) -- does work |
| 2021-05-31 09:46:53 | × | bilegeek quits (~bilegeek@2600:1008:b06d:65ed:93d7:e6a:a06d:9e4) (Quit: Leaving) |
| 2021-05-31 09:47:38 | <disconsis> | i'm not explaining this amazingly well, but please feel free to ask for any clarifications :P |
| 2021-05-31 09:48:38 | × | koishi_ quits (~koishi_@67.209.186.120.16clouds.com) (Remote host closed the connection) |
| 2021-05-31 09:49:07 | × | leeb quits (~leeb@KD111239155018.au-net.ne.jp) (Quit: WeeChat 3.1) |
| 2021-05-31 09:52:10 | <opqdonut> | disconsis: the problem is that since `ast` came out of an `Ast a`, it has type `AstF a (Ast a)` |
| 2021-05-31 09:53:18 | <disconsis> | opqdonut: any idea how i can get the same value to be of type `AstF a (Ast b)` without doing the hacky `ast { var = var}`? |
| 2021-05-31 09:54:18 | × | fabfianda quits (~fabfianda@net-93-148-125-174.cust.dsl.teletu.it) (Ping timeout: 268 seconds) |
| 2021-05-31 09:54:26 | <opqdonut> | no, not really, unless you can change the definition of Ast |
| 2021-05-31 09:54:41 | → | fabfianda joins (~fabfianda@mob-5-90-246-225.net.vodafone.it) |
| 2021-05-31 09:54:49 | <opqdonut> | you can of course give a nice name to the function `AstF a b -> AstF a c` |
| 2021-05-31 09:56:25 | <disconsis> | Hmm.. |
| 2021-05-31 09:56:43 | <disconsis> | One problem is that AstF contains more constructors, of which some do use the 'b' |
| 2021-05-31 09:56:52 | <opqdonut> | of course |
| 2021-05-31 09:56:57 | <disconsis> | So it's not possible to white `AstF a b -> AstF a c` in general |
| 2021-05-31 09:56:59 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-05-31 09:57:09 | × | hyiltiz quits (~quassel@31.220.5.250) (Ping timeout: 272 seconds) |
| 2021-05-31 09:57:14 | <opqdonut> | yeah I think you should just stick with the {} hack |
| 2021-05-31 09:57:19 | <disconsis> | I guess I'll just pattern match and create a new value |
All times are in UTC.