Logs: liberachat/#haskell
| 2021-06-15 17:56:32 | → | warnz joins (~warnz@2600:1700:77c0:5610:800b:6e01:97af:a956) |
| 2021-06-15 17:56:46 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 244 seconds) |
| 2021-06-15 17:56:55 | <monochrom> | I only know the broad answer "use the library part of pandoc". |
| 2021-06-15 17:57:05 | × | notzmv quits (~zmv@user/notzmv) (Read error: Connection reset by peer) |
| 2021-06-15 17:57:44 | <arjun> | Obo: https://paste.tomsmeding.com/I9tE2bBu |
| 2021-06-15 17:58:02 | <arjun> | monochrom: i am actively trying to avoid pandoc : P |
| 2021-06-15 17:58:44 | <arjun> | i am using cmark for the md -> html conversion. but it doesn't parse the yaml meta at the top. so i'd have to preprocess it. |
| 2021-06-15 17:59:27 | → | notzmv joins (~zmv@user/notzmv) |
| 2021-06-15 18:01:03 | × | peddie quits (~peddie@2001:470:69fc:105::25d) (Quit: Client limit exceeded: 10000) |
| 2021-06-15 18:01:30 | → | ixlun joins (~matthew@213.205.241.86) |
| 2021-06-15 18:03:38 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-06-15 18:06:35 | <cdsmith> | <dminuoso "Chris Smith: Drop the constraint"> Thanks, but the whole point of this is that I need the constraint. (Well, "need" is a strong word. I can hack something together with unsafePerformIO otherwise, but's pretty hacky.) |
| 2021-06-15 18:07:02 | <dminuoso> | That sounds to me like you're trying to be lazy. |
| 2021-06-15 18:07:25 | → | peddie joins (~peddie@2001:470:69fc:105::25d) |
| 2021-06-15 18:07:34 | <dminuoso> | If your newtype has a MonadIO instance, why do you think you need this? |
| 2021-06-15 18:07:36 | → | cfricke joins (~cfricke@user/cfricke) |
| 2021-06-15 18:08:00 | <dminuoso> | arjun: just use Data.List.break to split the lines into the header and the rest? |
| 2021-06-15 18:08:26 | ← | Profpatsch parts (~Profpatsc@static.88-198-193-255.clients.your-server.de) (WeeChat 3.1) |
| 2021-06-15 18:08:49 | <dminuoso> | naively it seems like you should be able to do something like: let ls = lines buf; (meta, rest) = break (isPrefixOf "```") (drop ls); in ... |
| 2021-06-15 18:09:39 | <arjun> | dminuoso: imma go try that, thanks |
| 2021-06-15 18:09:41 | <dminuoso> | Then you can hand off `drop 1 meta` to your YAML parser, and `rest` to whatever other part. |
| 2021-06-15 18:09:55 | <dminuoso> | or no, `init meta` |
| 2021-06-15 18:09:58 | → | SrPx joins (sid108780@id-108780.highgate.irccloud.com) |
| 2021-06-15 18:10:08 | <davean> | cdsmith: putting the MonadIO constraint *in* the type has a number of potential issues |
| 2021-06-15 18:10:28 | <SrPx> | Hey, I haven't used IRC lately. Is this where everyone moved from FreeNode? Or are people using other tools like Discord? |
| 2021-06-15 18:10:30 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-15 18:10:44 | <monochrom> | Yes for the former. |
| 2021-06-15 18:10:47 | <dminuoso> | cdsmith: Also I dont think it actually buys you anything. |
| 2021-06-15 18:10:59 | <davean> | dminuoso: mechanically no, its strictly wrose to have it there |
| 2021-06-15 18:11:07 | <davean> | dminuoso: but people get "upset" about putting it on functions |
| 2021-06-15 18:11:07 | <dminuoso> | yup |
| 2021-06-15 18:11:17 | <davean> | until they make it work, and then realize why no one thinks its a good iea |
| 2021-06-15 18:11:24 | <davean> | Its wrong - semanticly |
| 2021-06-15 18:11:30 | × | maralorn quits (~maralorn@2001:470:69fc:105::251) (Quit: Client limit exceeded: 10000) |
| 2021-06-15 18:11:38 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-06-15 18:11:38 | <dminuoso> | Indeed, it took me a long while to understand why constraints dont belong on data, they belong on functions. |
| 2021-06-15 18:11:41 | <davean> | it doesn't mean what you want it to mean |
| 2021-06-15 18:12:06 | → | maralorn joins (~maralorn@2001:470:69fc:105::251) |
| 2021-06-15 18:13:21 | × | etherington quits (~nagybogo@2a02:c7f:d425:9500:3ec0:37eb:211a:4131) (Quit: Client closed) |
| 2021-06-15 18:13:46 | <dminuoso> | davean: I think what this is, is a reminiscence of dependency injection at data instantiation time. |
| 2021-06-15 18:13:46 | → | Ariakenom joins (~Ariakenom@2001:9b1:efb:fc00:c958:4e9b:6898:197c) |
| 2021-06-15 18:14:51 | × | cyphase quits (~cyphase@c-73-222-119-252.hsd1.ca.comcast.net) (Read error: Connection reset by peer) |
| 2021-06-15 18:15:01 | <davean> | dminuoso: mmm, yah, I could see how someone could pattern match it from another language, but we have coherence |
| 2021-06-15 18:15:10 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds) |
| 2021-06-15 18:15:22 | × | altern quits (~altern@altern.corbina.com.ua) (Ping timeout: 244 seconds) |
| 2021-06-15 18:16:01 | → | fizbin joins (~fizbin@2601:8a:4080:1280:8c7e:5b3f:79d6:ec26) |
| 2021-06-15 18:16:05 | <cdsmith> | <dminuoso "If your newtype has a MonadIO in"> Actually, you may be write. Perhaps MonadIO should be in the instance context instead. |
| 2021-06-15 18:16:09 | × | siraben quits (~siraben@user/siraben) (Quit: issued !quit command) |
| 2021-06-15 18:16:13 | <cdsmith> | Err, right, not write |
| 2021-06-15 18:16:16 | <tomsmeding> | just for completeness, the sentiment that one shouldn't put constraints in data doesn't hold when we start having existentials, right? |
| 2021-06-15 18:16:31 | <dminuoso> | tomsmeding: Right. |
| 2021-06-15 18:16:45 | tomsmeding | has been doing lots of that lately |
| 2021-06-15 18:17:07 | <cdsmith> | Yeah, this isn't a constraint on the type. It's a contraint of a GADT constructor |
| 2021-06-15 18:17:07 | × | azeem quits (~azeem@dynamic-adsl-78-13-238-239.clienti.tiscali.it) (Read error: Connection reset by peer) |
| 2021-06-15 18:17:08 | <davean> | tomsmeding: yah thats ENTIRELY different |
| 2021-06-15 18:17:10 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 2021-06-15 18:17:18 | <dminuoso> | cdsmith: it is a constraint on the type. |
| 2021-06-15 18:17:21 | <davean> | tomsmeding: because thats actually a constraint |
| 2021-06-15 18:17:31 | → | tromp joins (~textual@dhcp-077-249-230-040.chello.nl) |
| 2021-06-15 18:17:42 | → | siraben joins (~siraben@user/siraben) |
| 2021-06-15 18:17:45 | → | azeem joins (~azeem@dynamic-adsl-78-13-238-239.clienti.tiscali.it) |
| 2021-06-15 18:17:49 | <tomsmeding> | davean: right; and including the dictionary in the data is actually the right thing to do there, operationally |
| 2021-06-15 18:18:02 | <dminuoso> | cdsmith: I invite you to just remove the MonadIO constraint from your data type definition, and perhaps switch to just a simple newtype. |
| 2021-06-15 18:18:10 | <cdsmith> | <dminuoso "Chris Smith: it is a constraint "> Not sure what you're referring to. I wrote: data MockT m a where MockT :: MonadIO m => ReaderT (MVar Foo) m a -> MockT m a |
| 2021-06-15 18:18:27 | <cdsmith> | which is clearly a GADT constraint, not a type constraint |
| 2021-06-15 18:18:29 | <zyklotomic> | dminuoso: "Secondly, minBound/maxBound should require a Proxy as argument like..." wait sorry late response, what does Proxy mean here |
| 2021-06-15 18:19:11 | <cdsmith> | In either case, though, I do think I can move the constraint to the instance, instead |
| 2021-06-15 18:19:12 | <monochrom> | This (read on for irony) is what's wrong with pronouns like this and it. |
| 2021-06-15 18:19:16 | <dminuoso> | cdsmith: Just write it as `newtype MockT m a = MockT { runMockT :: ReaderT (MVar Foo) m a }` |
| 2021-06-15 18:19:20 | <tomsmeding> | cdsmith: I think dminuoso is saying that it should, morally, be a type constraint; this regardless of the fact that it's currently a constraint on the GADT constructor |
| 2021-06-15 18:20:07 | <dminuoso> | cdsmith: You can then GND derive a MonadIO instance, and then you can liftIO freely inside `MockT m` as long as you have `MonadIO m` |
| 2021-06-15 18:20:18 | × | fizbin quits (~fizbin@2601:8a:4080:1280:8c7e:5b3f:79d6:ec26) (Ping timeout: 240 seconds) |
| 2021-06-15 18:21:27 | <cdsmith> | <dminuoso "Chris Smith: You can then GND de"> Sure, I'm doing that. Again, the key part that was missing was moving the constraint to the instance. I can't just delete the constraint. |
| 2021-06-15 18:21:49 | <dminuoso> | Ah I see. |
| 2021-06-15 18:21:54 | × | cfricke quits (~cfricke@user/cfricke) (Ping timeout: 240 seconds) |
| 2021-06-15 18:22:17 | <dminuoso> | cdsmith: If you GND derive it, the constraints is there automatically. :) |
| 2021-06-15 18:22:36 | <dminuoso> | (Because the MonadIO instance from ReaderT brings it along) |
| 2021-06-15 18:22:49 | × | BosonCollider quits (~olofs@90-227-86-119-no542.tbcn.telia.com) (Read error: No route to host) |
| 2021-06-15 18:23:01 | <dminuoso> | instance MonadIO m => MonadIO (ReaderT r m) |
| 2021-06-15 18:23:07 | → | BosonCollider joins (~olofs@90-227-86-119-no542.tbcn.telia.com) |
| 2021-06-15 18:23:19 | dminuoso | loves newtype + GND |
| 2021-06-15 18:23:27 | × | ddellacosta quits (~ddellacos@89.46.62.21) (Read error: Connection reset by peer) |
| 2021-06-15 18:23:39 | <cdsmith> | <dminuoso "Chris Smith: If you GND derive i"> Okay, I think we're just talking at cross purposes. Suppose there's some other class, like `class MonadFoo m where {...}`. I need `instance MonadIO m => MonadFoo (MockT m) where {...}`. I'd previously been trying to get THAT MonadIO constraint by adding it to the GADT, but it belongs on the instance |
| 2021-06-15 18:23:56 | → | ddellacosta joins (~ddellacos@89.46.62.21) |
| 2021-06-15 18:24:25 | <dminuoso> | cdsmith: If all MonadFoo demands it, make it a superclass of it. |
| 2021-06-15 18:24:34 | <dminuoso> | i.e. `class MonadIO m => MonadFoo m where ...` |
| 2021-06-15 18:24:44 | <dminuoso> | Is this what you were looking for? |
| 2021-06-15 18:24:47 | <cdsmith> | Well, no. MonadFoo doesn't need it. The implementation for MockT does |
| 2021-06-15 18:25:01 | <dminuoso> | There is no implementation for MockT. |
| 2021-06-15 18:25:03 | → | rk04 joins (~rk04@user/rajk) |
| 2021-06-15 18:25:10 | <dminuoso> | It's just a newtype, in what I showed you |
| 2021-06-15 18:25:20 | <cdsmith> | Sure there is. I'm confused... |
| 2021-06-15 18:25:23 | → | adam1 joins (~adam@2a02:8388:1903:9500:96e6:f7ff:fe92:4825) |
| 2021-06-15 18:25:44 | → | shelle joins (~shelle@ip-96-43-230-90.dsl.netrevolution.com) |
| 2021-06-15 18:25:45 | × | fef quits (~thedawn@user/thedawn) (Quit: Leaving) |
| 2021-06-15 18:26:08 | <cdsmith> | Okay, I'm thoroughly confused by how we're miscommunicating, but adding MonadIO to the instance context should solve me problem, so I'm going to do that! :) |
| 2021-06-15 18:26:48 | → | Topsi joins (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de) |
| 2021-06-15 18:27:19 | → | Topsi2 joins (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de) |
| 2021-06-15 18:27:33 | <lyxia> | In the Haskell report, the grammar is explicitly ambiguous, with the "meta-rule" that let/if/lambdas "extend as far to the right as possible". Is the reason for this presentation to "make the spec simpler"? Because I find interpreting that rule to implement it correctly a bit of a headache... |
| 2021-06-15 18:28:18 | × | chddr quits (~Thunderbi@31.148.23.125) (Ping timeout: 240 seconds) |
All times are in UTC.