Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 386 387 388 389 390 391 392 393 394 395 396 .. 17996
1,799,515 events total
2021-06-10 19:50:47 <exarkun> I don't understand why https://hackage.haskell.org/package/wai-3.2.2.1/docs/Network-Wai.html#t:Request doesn't say more about Request, either about the constructor or the (uh oh I forget what they're called) setters / fields
2021-06-10 19:51:08 <safinaskar> Hi! A long time ago i wrote my proof checker in haskell. I wanted to be able to interactively see errors (from this prover) in my editor. so i wrote program in c++ (!!!!) (language from hell) using qt. This program was simple text editor. After every keystroke it did run my prover and showed me place of error
2021-06-10 19:51:12 <safinaskar> all this worked nice
2021-06-10 19:52:18 <dminuoso> exarkun: Ah that's a haddocks issue.
2021-06-10 19:52:27 <safinaskar> my question is: how to do the same using language server protocol? (with vscode instead of my qt program?)
2021-06-10 19:52:38 <dminuoso> exarkun: The package exports the field accessors explicitly, without exporting the data constructor.
2021-06-10 19:52:54 <safinaskar> is there some example? so far i found none and it seems it is easier to continue with that ugly qt hack
2021-06-10 19:52:54 <xerox> exarkun: because the module doesn't export those
2021-06-10 19:52:54 <dminuoso> This is a common trick to preserve PVP compability with packages, while allowing extensibility
2021-06-10 19:53:02 <dminuoso> xerox: It does.
2021-06-10 19:53:17 <dminuoso> exarkun: You have to look at the source code to know this. This haddock should *really* document it.
2021-06-10 19:53:22 <xerox> check out the difference in the module exports between Request and say RequestBodyLength (..) https://hackage.haskell.org/package/wai-3.2.2.1/docs/src/Network.Wai.html
2021-06-10 19:53:46 <exarkun> requestHeaders is exported, https://hackage.haskell.org/package/wai-3.2.2.1/docs/src/Network.Wai.Internal.html#requestHeaders
2021-06-10 19:53:50 <dminuoso> exarkun: So you can write `defaultRequest { rawPathInfo = ... }`. There's just no hint whatever in haddock to know that rawPathInfo is an accessor.
2021-06-10 19:53:52 <exarkun> But ... Request(requestHeaders) is not exported?
2021-06-10 19:53:57 <exarkun> (but they're the same thing?)
2021-06-10 19:54:02 <dminuoso> exarkun: Did you read what I just wrote?
2021-06-10 19:54:16 <dminuoso> Request(requestHeaders) would export both the constructor and the field
2021-06-10 19:54:18 <exarkun> dminuoso: I did but I might not have understood it
2021-06-10 19:54:20 <dminuoso> The point is to not export the Constructor.
2021-06-10 19:54:28 <dminuoso> Okay, so do you know what PVP is?
2021-06-10 19:54:38 <exarkun> The versioning scheme?
2021-06-10 19:54:40 <dminuoso> Yes
2021-06-10 19:54:55 <exarkun> more or less
2021-06-10 19:55:10 <dminuoso> If you wanted to extend the constructor with an additional field and export the constructor, then that would demand a major version bump
2021-06-10 19:55:16 <dminuoso> Because suddenly the constructor takes an additional parameter
2021-06-10 19:55:30 awk is now known as mnrmnaugh
2021-06-10 19:55:46 <dminuoso> Often that's not necessary, maybe because you have sensible and backwards compatible defaults for newly added fields. It'd be nicer if you could avoid a major version bump
2021-06-10 19:56:02 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.1)
2021-06-10 19:56:11 <dminuoso> So what you do is: provide a smart constructor to provide a (often empty/useless) default, export all accessors, and then you can use field update syntax
2021-06-10 19:56:34 × _ht quits (~quassel@82-169-194-8.biz.kpn.net) (Remote host closed the connection)
2021-06-10 19:56:34 <dminuoso> It's a trick some people have adopted. I think Snoyman popularized it
2021-06-10 19:57:06 <dminuoso> (But with this trick you absolutely cant export the constructor itself, otherwise your API would have a function that might change when a field gets added)
2021-06-10 19:57:50 <dminuoso> All of this is oblivious to haddock itself, sadly. You just see a bunch of functions, and dont even know they are accessor functions (which you could use with field update syntax)
2021-06-10 19:58:10 <dminuoso> exarkun: Your only hint is this section name: https://hackage.haskell.org/package/wai-3.2.2.1/docs/Network-Wai.html#g:3
2021-06-10 19:58:14 <dminuoso> "Request accessors"
2021-06-10 19:58:31 <dminuoso> (Which haddock still does, but it's extremely subtle)
2021-06-10 19:59:18 dunkeln joins (~dunkeln@94.129.65.28)
2021-06-10 19:59:31 <dminuoso> Should correct myself, its not invisible to haddock, it's just very poorly visualized..
2021-06-10 20:01:12 <dminuoso> exarkun: https://www.yesodweb.com/blog/2015/03/designing-apis-for-extensibility
2021-06-10 20:01:37 <exarkun> Okay, I think I get it and maybe now I can be on alert for "accessors" in the future
2021-06-10 20:01:38 <dminuoso> https://www.snoyman.com/blog/2016/11/designing-apis-for-extensibility/
2021-06-10 20:01:39 <dminuoso> Ah that's the one
2021-06-10 20:02:10 <exarkun> and thanks for that link
2021-06-10 20:02:43 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-06-10 20:03:18 × tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Client Quit)
2021-06-10 20:04:42 × jmcarthur quits (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
2021-06-10 20:04:45 × alphacath quits (~alpha@host-79-36-63-89.retail.telecomitalia.it) (Quit: bye)
2021-06-10 20:05:04 × juhp quits (~juhp@128.106.188.66) (Ping timeout: 245 seconds)
2021-06-10 20:05:41 × amahl quits (~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi) (Ping timeout: 272 seconds)
2021-06-10 20:06:49 juhp joins (~juhp@128.106.188.66)
2021-06-10 20:07:23 jmcarthur joins (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net)
2021-06-10 20:08:06 gumm joins (~user@88.163.231.79)
2021-06-10 20:08:19 × gumm quits (~user@88.163.231.79) (Remote host closed the connection)
2021-06-10 20:08:31 jakalx joins (~jakalx@base.jakalx.net)
2021-06-10 20:09:17 malvo parts (~malvo@malvo.org) ()
2021-06-10 20:09:21 × agumonke` quits (~user@88.163.231.79) (Ping timeout: 252 seconds)
2021-06-10 20:09:35 agumonke` joins (~user@88.163.231.79)
2021-06-10 20:12:06 × wonko quits (~wjc@62.115.229.50) (Ping timeout: 252 seconds)
2021-06-10 20:12:47 × Katarushisu quits (~Katarushi@cpc152083-finc20-2-0-cust170.4-2.cable.virginm.net) (Quit: The Lounge - https://thelounge.chat)
2021-06-10 20:14:02 Katarushisu joins (~Katarushi@cpc152083-finc20-2-0-cust170.4-2.cable.virginm.net)
2021-06-10 20:15:24 × reumeth quits (~reumeth@user/reumeth) (Remote host closed the connection)
2021-06-10 20:15:55 reumeth joins (~reumeth@user/reumeth)
2021-06-10 20:16:54 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:2121:a570:d35e:ba7a) (Remote host closed the connection)
2021-06-10 20:20:12 × Topsi quits (~Tobias@dyndsl-037-138-065-228.ewe-ip-backbone.de) (Ping timeout: 272 seconds)
2021-06-10 20:20:50 × reumeth quits (~reumeth@user/reumeth) (Ping timeout: 272 seconds)
2021-06-10 20:22:39 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-06-10 20:24:14 MQ-17J joins (~MQ-17J@8.21.10.116)
2021-06-10 20:24:31 safinaskar parts (~safinaska@109-252-90-89.nat.spd-mgts.ru) ()
2021-06-10 20:24:38 × Shaeto quits (~Shaeto@94.25.234.141) (Ping timeout: 272 seconds)
2021-06-10 20:24:53 × waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 272 seconds)
2021-06-10 20:25:18 Shaeto joins (~Shaeto@94.25.234.158)
2021-06-10 20:27:48 Guest50 joins (~Guest50@109-252-90-89.nat.spd-mgts.ru)
2021-06-10 20:28:07 Guest50 parts (~Guest50@109-252-90-89.nat.spd-mgts.ru) ()
2021-06-10 20:30:01 × dut quits (~dut@user/dut) (Quit: Leaving)
2021-06-10 20:30:33 × jmcarthur quits (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
2021-06-10 20:30:58 × hueso_ quits (~root@152.170.216.40) (Read error: Connection reset by peer)
2021-06-10 20:32:04 hueso joins (~root@152.170.216.40)
2021-06-10 20:32:09 × bontaq quits (~user@ool-18e47f8d.dyn.optonline.net) (Ping timeout: 245 seconds)
2021-06-10 20:33:18 × Deewiant quits (~deewiant@de1.ut.deewiant.iki.fi) (Ping timeout: 264 seconds)
2021-06-10 20:33:30 kenran joins (~kenran@200116b82b390f00b0c803a76fadf7bb.dip.versatel-1u1.de)
2021-06-10 20:33:38 Deewiant joins (~deewiant@de1.ut.deewiant.iki.fi)
2021-06-10 20:36:15 jmcarthur joins (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net)
2021-06-10 20:39:36 × gzj quits (~GZJ0X@199.193.127.217.16clouds.com) (Remote host closed the connection)
2021-06-10 20:43:10 BosonCollider joins (~olofs@90-227-86-119-no542.tbcn.telia.com)
2021-06-10 20:43:11 amahl joins (~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi)
2021-06-10 20:46:21 <kenran> I'm trying to understand how to use the function `deserialiseIncremental :: ST s (IDecoder s a)` from the serialise library. It's probably due to me not having used the ST monad before. I'm struggling as to how even start.
2021-06-10 20:47:47 thyriaen joins (~thyriaen@45.178.73.238)
2021-06-10 20:48:10 <kenran> I mean, the outline in my head looks like starting with `runST $ do x <- serialiseIncremental`, then I'd have to match x: the cases Fail or Done should be straightforward, but Partial contains a continuation that I'd have to get some ByteString for to apply to.
2021-06-10 20:48:55 <kenran> The ByteString is something I'm getting by reading from a Handle, but that in turn requires IO, not ST. But I cannot leave the ST monad and "reenter" with runST, can I?
2021-06-10 20:50:12 × bitmapper quits (uid464869@id-464869.tooting.irccloud.com) (Quit: Connection closed for inactivity)
2021-06-10 20:51:28 <kenran> (background: there is a Handle (to an UNIX pipe) and lazy bytestrings (gotten from the serialise library) are written to it. But I don't know how to read multiple values in succession, because LBS.hGetContents seems to want to read to the end, and thus it only works once. So I thought maybe using hGet together with the incremental deserialisiation could help. But I'm open to any suggestions.)
2021-06-10 20:53:33 × Baloo_ quits (~Baloo_@193.138.218.166) (Quit: Leaving)
2021-06-10 20:54:21 jolly29 joins (~jolly@208.180.97.158)
2021-06-10 20:57:12 × jolly quits (~jolly@208.180.97.158) (Ping timeout: 252 seconds)
2021-06-10 20:57:20 × jmcarthur quits (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
2021-06-10 20:57:21 × yoctocell quits (~yoctocell@h87-96-130-155.cust.a3fiber.se) (Quit: C-x C-c, Shutting down OS...)
2021-06-10 20:57:34 × mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Ping timeout: 272 seconds)
2021-06-10 20:57:56 <nshepperd> you can convert ST to IO
2021-06-10 20:58:01 <ski> kenran : hm, <https://downloads.haskell.org/~ghc/latest/docs/html/libraries/base-4.15.0.0/Control-Monad-ST.html#v:stToIO> ?

All times are in UTC.