Logs: freenode/#haskell
| 2020-10-31 11:50:32 | → | __monty__ joins (~toonn@unaffiliated/toonn) |
| 2020-10-31 11:50:38 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds) |
| 2020-10-31 11:52:24 | <simon> | I'm trying to test a Servant API. I'm getting a type mismatch between 'Handler a' and 'ClientM a' following this tutorial: https://docs.servant.dev/en/stable/cookbook/testing/Testing.html#strategy-1-spin-up-a-server-create-a-client-make-some-requests -- my code and type error can be found here: https://gist.github.com/sshine/12ba219e94ea043aabf171b2918a1c07 |
| 2020-10-31 11:54:51 | <simon> | so, when reasoning about this error myself, I'd have to agree with GHC that a Server is not a Client. so I'm not sure why the tutorial so freely uses 'runClientM (createUser 50001)' when 'createUser :: Integer -> Handler User'. I don't know if 'Handler' is server-specific, but at least it aliases to 'Server' and does not alias to 'ClientM'. |
| 2020-10-31 11:55:04 | → | ahmr88 joins (~ahmr88@cpc85006-haye22-2-0-cust131.17-4.cable.virginm.net) |
| 2020-10-31 11:57:18 | × | christo quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2020-10-31 11:57:34 | → | christo joins (~chris@81.96.113.213) |
| 2020-10-31 11:59:17 | <__monty__> | I'm not familiar with servant but I don't see a problem with your reasoning. |
| 2020-10-31 11:59:48 | × | ahmr88 quits (~ahmr88@cpc85006-haye22-2-0-cust131.17-4.cable.virginm.net) (Ping timeout: 260 seconds) |
| 2020-10-31 12:00:01 | × | cassier quits (~cassier@195.140.213.38) () |
| 2020-10-31 12:01:09 | <dminuoso> | simon: You're probably just confused about scoping here |
| 2020-10-31 12:01:23 | <dminuoso> | simon: In the documentation example, there's two different createUser |
| 2020-10-31 12:01:47 | <dminuoso> | Inside the code block you're looking at, there is: |
| 2020-10-31 12:01:56 | <__monty__> | Ah, you're right, didn't see the local binding. |
| 2020-10-31 12:02:04 | <dminuoso> | `let createUser = client (Proxy :: Proxy UserApi) ... runClientM (createUser 50001) (clientEnv port)` |
| 2020-10-31 12:02:19 | <__monty__> | Not exactly stellar pedagogy of the docs maybe. |
| 2020-10-31 12:02:26 | → | Gurkenglas joins (~Gurkengla@unaffiliated/gurkenglas) |
| 2020-10-31 12:02:49 | <dminuoso> | Dunno, but if you copy and paste the examples as they are, they work just fine. |
| 2020-10-31 12:02:55 | <dminuoso> | And the code comments make it clear too |
| 2020-10-31 12:03:07 | × | chaosmasttter quits (~chaosmast@p200300c4a72dee0155b8dce6c2fd4efc.dip0.t-ipconnect.de) (Ping timeout: 268 seconds) |
| 2020-10-31 12:03:13 | <dminuoso> | But if you think there's improvements to be made, make a PR? |
| 2020-10-31 12:03:53 | × | MindlessDrone quits (~MindlessD@unaffiliated/mindlessdrone) (Ping timeout: 260 seconds) |
| 2020-10-31 12:06:46 | <__monty__> | Haven't looked into servant enough to have a well founded opinion. Imo, "the examples work when copied verbatim," shouldn't be the goal for tutorial-style docs. There could be great reasons for the apparent shadowing though, if server and client code are clearly separated it might be a good way to make it easy to find related code "on the other side." |
| 2020-10-31 12:07:20 | <dminuoso> | Well, I think it's reasonable to expect a user to *read* the examples? |
| 2020-10-31 12:07:26 | <dminuoso> | Rather than just skim |
| 2020-10-31 12:08:17 | → | MindlessDrone joins (~MindlessD@unaffiliated/mindlessdrone) |
| 2020-10-31 12:08:31 | <dminuoso> | Plus |
| 2020-10-31 12:08:37 | <dminuoso> | This is deep inside the *testing* documentation |
| 2020-10-31 12:08:55 | <__monty__> | Sure, but relying on careful reading and understanding of each line is wholly unnecessary. It's not like it's important the name is shadowed. |
| 2020-10-31 12:10:10 | hackage | HUnit 1.6.1.0 - A unit testing framework for Haskell https://hackage.haskell.org/package/HUnit-1.6.1.0 (SimonHengel) |
| 2020-10-31 12:10:21 | <dminuoso> | __monty__: At the beginning the documentation starts off with |
| 2020-10-31 12:10:23 | <dminuoso> | "We’ll use servant-client to derive client functions and then send valid requests to our API, running in another thread. This is great for testing that our business logic is correctly implemented with only valid HTTP requests." |
| 2020-10-31 12:10:37 | <dminuoso> | But anyway |
| 2020-10-31 12:10:56 | <Uniaika> | servant-client is awesome |
| 2020-10-31 12:11:07 | <simon> | dminuoso, d'oh. thanks. :) |
| 2020-10-31 12:11:37 | → | geekosaur joins (ac3a3be8@172.58.59.232) |
| 2020-10-31 12:12:08 | <dminuoso> | Overall, when writing servant code, you either end up shadowing names a lot, of you find yourself with very verbose naming |
| 2020-10-31 12:12:14 | <dminuoso> | Since you might have: |
| 2020-10-31 12:12:29 | <dminuoso> | createUser :: Proxy UserEndpoint |
| 2020-10-31 12:12:30 | <__monty__> | Nothing wrong with verbosity in a 20 line example. |
| 2020-10-31 12:12:34 | <dminuoso> | createUser :: ClientM ... |
| 2020-10-31 12:12:37 | <dminuoso> | createUser :: Handler ... |
| 2020-10-31 12:12:45 | <dminuoso> | createUser :: User -> IO ... |
| 2020-10-31 12:13:17 | <__monty__> | You can even add a note "In a real app just shadow the names for sanity's sake." |
| 2020-10-31 12:13:18 | <dminuoso> | __monty__: Sure, but the code style will reflect the authors opinion. |
| 2020-10-31 12:13:43 | <dminuoso> | Dunno, I think when you're that far in, you shouldn't get confused by this |
| 2020-10-31 12:13:45 | <dminuoso> | It's not the beginning |
| 2020-10-31 12:13:58 | <dminuoso> | It's almost at the end of the documentation when its about testing |
| 2020-10-31 12:14:12 | × | christo quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2020-10-31 12:14:37 | <__monty__> | It's a cookbook it's not intended to be read front to back. So it's not at the end. It's exactly at the start if what you're looking for is how to test your business logic... |
| 2020-10-31 12:14:49 | <dminuoso> | make a PR if you think its worthwhile changing |
| 2020-10-31 12:16:35 | → | dansho joins (~dansho@ip68-108-167-185.lv.lv.cox.net) |
| 2020-10-31 12:17:42 | → | dyeplexer joins (~lol@unaffiliated/terpin) |
| 2020-10-31 12:17:58 | <__monty__> | I've already said I don't know enough about servant to go changing their docs, there's plenty of docs to improve that I do feel like I have enough experience with to make good contributions. Like the GHC user guide and the cabal docs. |
| 2020-10-31 12:21:58 | × | invaser quits (~Thunderbi@31.148.23.125) (Ping timeout: 260 seconds) |
| 2020-10-31 12:22:58 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-31 12:23:43 | <Athas> | Which exception does Haskell for SIGPIPE (the one that manifests as a "Broken pipe" error message)? |
| 2020-10-31 12:24:35 | <dminuoso> | Athas: ResourceVanished |
| 2020-10-31 12:25:11 | <Athas> | From GHC.IO.Exception? Makes sense. |
| 2020-10-31 12:25:12 | <Athas> | Thanks. |
| 2020-10-31 12:27:44 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2020-10-31 12:28:40 | → | christo joins (~chris@81.96.113.213) |
| 2020-10-31 12:29:23 | × | dansho quits (~dansho@ip68-108-167-185.lv.lv.cox.net) (Ping timeout: 265 seconds) |
| 2020-10-31 12:30:55 | → | jedws joins (~jedws@101.184.150.81) |
| 2020-10-31 12:32:11 | → | hc joins (~hc@bsd.pm) |
| 2020-10-31 12:32:49 | × | christo quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2020-10-31 12:33:49 | × | jrqc quits (~rofl@96.78.87.197) (Ping timeout: 264 seconds) |
| 2020-10-31 12:33:56 | → | jrqc joins (~rofl@96.78.87.197) |
| 2020-10-31 12:34:25 | × | lxsameer quits (lxsameer@gateway/vpn/protonvpn/lxsameer) (Ping timeout: 240 seconds) |
| 2020-10-31 12:34:46 | → | wei2912 joins (~wei2912@unaffiliated/wei2912) |
| 2020-10-31 12:35:26 | × | toorevitimirp quits (~tooreviti@117.182.180.36) (Ping timeout: 264 seconds) |
| 2020-10-31 12:36:31 | → | drbean joins (~drbean@TC210-63-209-85.static.apol.com.tw) |
| 2020-10-31 12:39:53 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-31 12:40:21 | → | Saukk joins (~Saukk@2001:998:f9:2914:1c59:9bb5:b94c:4) |
| 2020-10-31 12:44:50 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-10-31 12:45:39 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-31 12:48:59 | → | jakob_ joins (~textual@p200300f49f1622007caf13ec66be0ccb.dip0.t-ipconnect.de) |
| 2020-10-31 12:50:04 | × | lemmih quits (~lemmih@2406:3003:2072:44:2d80:b13f:a816:7456) (Remote host closed the connection) |
| 2020-10-31 12:50:18 | → | lxsameer joins (lxsameer@gateway/vpn/protonvpn/lxsameer) |
| 2020-10-31 12:50:25 | → | lemmih joins (~lemmih@2406:3003:2072:44:51b:ea3d:d135:394c) |
| 2020-10-31 12:54:24 | → | leoburd joins (~leoburd@84.39.116.180) |
| 2020-10-31 12:57:53 | → | Tario joins (~Tario@201.204.63.11) |
| 2020-10-31 12:58:50 | × | jedws quits (~jedws@101.184.150.81) (Ping timeout: 260 seconds) |
| 2020-10-31 13:00:15 | × | Saukk quits (~Saukk@2001:998:f9:2914:1c59:9bb5:b94c:4) (Remote host closed the connection) |
| 2020-10-31 13:01:08 | → | Ohg joins (~ohg@host31-54-224-58.range31-54.btcentralplus.com) |
| 2020-10-31 13:01:18 | → | toorevitimirp joins (~tooreviti@117.182.183.132) |
| 2020-10-31 13:06:12 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-10-31 13:06:58 | × | thir quits (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 2020-10-31 13:07:24 | → | thir joins (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) |
| 2020-10-31 13:10:25 | × | lxsameer quits (lxsameer@gateway/vpn/protonvpn/lxsameer) (Ping timeout: 240 seconds) |
| 2020-10-31 13:11:34 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 268 seconds) |
| 2020-10-31 13:12:15 | → | machinedgod joins (~machinedg@24.105.81.50) |
| 2020-10-31 13:12:35 | × | carlomagno1 quits (~cararell@148.87.23.4) (Quit: Leaving.) |
| 2020-10-31 13:14:43 | → | britva joins (~britva@31-10-157-156.cgn.dynamic.upc.ch) |
| 2020-10-31 13:14:44 | × | thir quits (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
| 2020-10-31 13:16:24 | → | justanotheruser joins (~justanoth@unaffiliated/justanotheruser) |
| 2020-10-31 13:17:38 | × | nschoe quits (~quassel@91-175-19-30.subs.proxad.net) (Ping timeout: 258 seconds) |
| 2020-10-31 13:18:11 | → | solonarv joins (~solonarv@astrasbourg-653-1-117-122.w90-33.abo.wanadoo.fr) |
| 2020-10-31 13:22:59 | × | LKoen quits (~LKoen@81.255.219.130) (Remote host closed the connection) |
| 2020-10-31 13:23:18 | → | Chi1thangoo joins (~Chi1thang@87.112.60.168) |
All times are in UTC.