Logs: liberachat/#haskell
| 2021-06-02 22:36:54 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 264 seconds) |
| 2021-06-02 22:37:25 | <hpc> | and then you can run "curl http://localhost/users/5" to get that user's data |
| 2021-06-02 22:38:29 | × | davidnutting quits (~nuttingd@75.164.99.232) (Quit: WeeChat 3.1) |
| 2021-06-02 22:38:34 | → | favonia joins (~favonia@user/favonia) |
| 2021-06-02 22:39:01 | <dminuoso> | djb2021: Concretely, servant lets you a) generate a client automatically (with automatically inferred types!) for each endpoint, b) with the type checker verify that your request handlers match the request/response types exactly (so you cant forget an argument, or falsey assume that the specified userId is of type String), c) you can automatically generate documentation - all from a single type. |
| 2021-06-02 22:39:12 | <dminuoso> | All this is driven by complex type level computation |
| 2021-06-02 22:39:26 | → | davidnutting joins (~nuttingd@75.164.99.232) |
| 2021-06-02 22:39:41 | × | davidnutting quits (~nuttingd@75.164.99.232) (Client Quit) |
| 2021-06-02 22:40:02 | × | __monty__ quits (~toonn@user/toonn) (Quit: leaving) |
| 2021-06-02 22:41:18 | → | ddellacosta joins (~ddellacos@86.106.121.77) |
| 2021-06-02 22:41:31 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Remote host closed the connection) |
| 2021-06-02 22:43:04 | → | myShoggoth joins (~myShoggot@97-120-89-117.ptld.qwest.net) |
| 2021-06-02 22:43:07 | × | derelict quits (~winter@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com) (Ping timeout: 268 seconds) |
| 2021-06-02 22:43:26 | ← | tonyday parts (~user@202-65-93-249.ip4.superloop.com) (ERC (IRC client for Emacs 28.0.50)) |
| 2021-06-02 22:44:09 | <djb2021> | let me summarize if i understood correctly: i design an API by defining it as a type? where is the difference to the way that is done with swagger-codegen? with this approach (in java) code is generated for the controller and client code generation is possible there too but i have never used it. |
| 2021-06-02 22:45:07 | → | renzhi joins (~xp@2607:fa49:6500:bc00::e7b) |
| 2021-06-02 22:45:09 | <djb2021> | where exactly is the strength |
| 2021-06-02 22:45:20 | <djb2021> | of the servant approach? |
| 2021-06-02 22:45:53 | × | ddellacosta quits (~ddellacos@86.106.121.77) (Ping timeout: 252 seconds) |
| 2021-06-02 22:46:00 | <dminuoso> | djb2021: with swagger there is no guarantee your swagger spec is ever in sync with the code. you can simply forget to re-run your code generator. |
| 2021-06-02 22:46:10 | <hpc> | the advantage is remaining in-language, rather than having to resort to writing some kind of yaml/json/xml file |
| 2021-06-02 22:46:13 | <dminuoso> | and this applies to every part that uses swagger |
| 2021-06-02 22:46:44 | <dminuoso> | djb2021: with servant, if the type ever changes and you forget to update your code, it will produce a type error. |
| 2021-06-02 22:47:41 | × | jolly quits (~jolly@208.180.97.158) (Ping timeout: 272 seconds) |
| 2021-06-02 22:48:02 | <dminuoso> | and servant offers hooks to customize behavior in the server for example, allowing you to attach further arbitrary things onto the API |
| 2021-06-02 22:49:16 | <dminuoso> | say a full authentication, which automatically communicates the logged in user into the type system, so that the handlers suddenly receive an additional argument for the user - but not because its buitin but because you can extend it this way |
| 2021-06-02 22:49:18 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-02 22:53:07 | <djb2021> | ok, i understand that because the definitions are on the type level any missing implementation detail is found during compile time. This is a clear advantage. But isn't the API first approach (think of several teams, some of them for frontends) a good thing? Is it better to define an API in the language? |
| 2021-06-02 22:53:54 | <dminuoso> | to be fair, servant was an experiment originally I think |
| 2021-06-02 22:54:27 | × | myShoggoth quits (~myShoggot@97-120-89-117.ptld.qwest.net) (Read error: Connection reset by peer) |
| 2021-06-02 22:54:46 | → | myShoggoth joins (~myShoggot@97-120-89-117.ptld.qwest.net) |
| 2021-06-02 22:54:54 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds) |
| 2021-06-02 22:55:39 | <dminuoso> | servant comes at a steep cost, mistakes result in type errors that can be hard to decipher - especially to someone new to servant. you accumulate a lot of extensions to even express a type, and then you might be confused about what things even mean |
| 2021-06-02 22:56:34 | <dminuoso> | Is it good? I think it has good uses, but wouldn't recommend it to everybody. I merely mentioned it to demonstrate what we can do just at the type level, where you might have thought `Int` and `(->)` was the extend of it. :p |
| 2021-06-02 22:56:45 | → | pera joins (~pera@0541db7e.skybroadband.com) |
| 2021-06-02 22:57:07 | pera | is now known as Guest3714 |
| 2021-06-02 22:57:11 | <djb2021> | ok, wait, i have been reading a little bit through servant -- with servant i can combine several APIs to a resulting single API, right? |
| 2021-06-02 22:57:25 | <dminuoso> | what do you mean? |
| 2021-06-02 22:57:35 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:3547:b6d4:7412:5857) (Remote host closed the connection) |
| 2021-06-02 22:58:04 | × | yaroot quits (~yaroot@6.3.30.125.dy.iij4u.or.jp) (Quit: The Lounge - https://thelounge.chat) |
| 2021-06-02 22:58:53 | <djb2021> | ok, this was the description for a union of two apis, get and post |
| 2021-06-02 22:59:00 | → | yaroot joins (~yaroot@6.3.30.125.dy.iij4u.or.jp) |
| 2021-06-02 22:59:02 | <djb2021> | so this is similar to swagger |
| 2021-06-02 22:59:09 | <dminuoso> | yeah, with servant you usually describe a set of endpoints |
| 2021-06-02 22:59:13 | → | ddellacosta joins (~ddellacos@86.106.121.72) |
| 2021-06-02 22:59:15 | × | Guest3714 quits (~pera@0541db7e.skybroadband.com) (Client Quit) |
| 2021-06-02 23:00:07 | <djb2021> | and servant supports export of that API to OpenApI / Swagger? |
| 2021-06-02 23:00:27 | <djb2021> | and client code generation for test? |
| 2021-06-02 23:00:41 | → | benin0 joins (~benin@183.82.205.186) |
| 2021-06-02 23:00:44 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:3547:b6d4:7412:5857) |
| 2021-06-02 23:00:45 | → | dmwit joins (~dmwit@pool-96-255-233-247.washdc.fios.verizon.net) |
| 2021-06-02 23:00:48 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-02 23:00:55 | <dminuoso> | there is a package servant-swagger and servant-openapi, yes. |
| 2021-06-02 23:01:11 | <dminuoso> | Which automatically generate appropriate swagger specs for you |
| 2021-06-02 23:01:21 | <djb2021> | great |
| 2021-06-02 23:01:51 | <dminuoso> | You just need to deal with schemas for your types, but you can use generics to automatically boiler plate most of it |
| 2021-06-02 23:02:06 | × | raehik1 quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 264 seconds) |
| 2021-06-02 23:02:19 | → | boioioing joins (~boioioing@cpe-76-84-141-127.neb.res.rr.com) |
| 2021-06-02 23:02:38 | <dminuoso> | https://gist.github.com/dminuoso/fde24babea76ad23af01eb650ca185e7 |
| 2021-06-02 23:02:40 | <dminuoso> | Looks like this |
| 2021-06-02 23:03:19 | × | Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.) |
| 2021-06-02 23:03:54 | × | ddellacosta quits (~ddellacos@86.106.121.72) (Ping timeout: 272 seconds) |
| 2021-06-02 23:04:55 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 245 seconds) |
| 2021-06-02 23:05:33 | <djb2021> | i am hoping to implement a service with that soon, i wanted to learn that for a long time, but i never got the time to do that. This year it looks good, however. Let's see. |
| 2021-06-02 23:06:31 | <djb2021> | Thank you very much! |
| 2021-06-02 23:06:58 | <djb2021> | Have a good day / night. |
| 2021-06-02 23:09:55 | × | dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 245 seconds) |
| 2021-06-02 23:11:58 | → | falafel_ joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) |
| 2021-06-02 23:12:17 | × | falafel_ quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Remote host closed the connection) |
| 2021-06-02 23:12:51 | × | djb2021 quits (~djb2021@HSI-KBW-091-089-090-070.hsi2.kabelbw.de) (Quit: Client closed) |
| 2021-06-02 23:16:41 | → | ddellacosta joins (~ddellacos@86.106.121.100) |
| 2021-06-02 23:17:50 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 272 seconds) |
| 2021-06-02 23:18:15 | → | favonia joins (~favonia@user/favonia) |
| 2021-06-02 23:18:46 | → | falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) |
| 2021-06-02 23:20:05 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Ping timeout: 265 seconds) |
| 2021-06-02 23:20:56 | → | bfrk1 joins (~Thunderbi@200116b8456bb4003c666de9803185e6.dip.versatel-1u1.de) |
| 2021-06-02 23:21:05 | × | bfrk quits (~Thunderbi@200116b845fca000f97ff890167a6943.dip.versatel-1u1.de) (Ping timeout: 252 seconds) |
| 2021-06-02 23:21:05 | bfrk1 | is now known as bfrk |
| 2021-06-02 23:21:09 | → | betelgeuse0 joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-02 23:21:38 | × | ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 272 seconds) |
| 2021-06-02 23:22:38 | → | dunkeln joins (~dunkeln@94.129.65.28) |
| 2021-06-02 23:24:19 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-02 23:24:26 | niko | is now known as o |
| 2021-06-02 23:27:54 | × | dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 264 seconds) |
| 2021-06-02 23:29:33 | × | ubikium quits (~ubikium@113x43x248x70.ap113.ftth.arteria-hikari.net) (Quit: Quit) |
| 2021-06-02 23:29:42 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds) |
| 2021-06-02 23:35:00 | → | ddellacosta joins (~ddellacos@86.106.121.61) |
| 2021-06-02 23:38:31 | → | beka joins (~beka@104.193.170-254.PUBLIC.monkeybrains.net) |
| 2021-06-02 23:39:51 | × | waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 268 seconds) |
| 2021-06-02 23:39:54 | × | ddellacosta quits (~ddellacos@86.106.121.61) (Ping timeout: 264 seconds) |
| 2021-06-02 23:41:13 | → | waleee joins (~waleee@h-98-128-228-119.NA.cust.bahnhof.se) |
| 2021-06-02 23:44:51 | × | bfrk quits (~Thunderbi@200116b8456bb4003c666de9803185e6.dip.versatel-1u1.de) (Quit: bfrk) |
| 2021-06-02 23:45:13 | × | orion quits (~orion@user/orion) (Read error: Connection reset by peer) |
| 2021-06-02 23:45:25 | → | orion joins (~orion@user/orion) |
| 2021-06-02 23:49:30 | × | dpl_ quits (~dpl@77-121-78-163.chn.volia.net) (Ping timeout: 264 seconds) |
| 2021-06-02 23:52:30 | → | ddellacosta joins (~ddellacos@89.46.62.63) |
| 2021-06-02 23:56:33 | <boxscape> | Does anyone use AccumT? |
| 2021-06-02 23:56:46 | <boxscape> | I just saw it for the first time, but never saw it listed in lists of Monad Transfomers |
| 2021-06-02 23:56:50 | × | ddellacosta quits (~ddellacos@89.46.62.63) (Ping timeout: 252 seconds) |
| 2021-06-02 23:57:05 | <boxscape> | (or lists of Monads, for that matter) |
All times are in UTC.