Logs: freenode/#haskell
| 2021-05-16 17:34:55 | <charukiewicz> | The reason for this is because I'm okay with keeping my model types as comprised of mostly primitive types and then convert them to domain types through simple conversion functions, as necessary |
| 2021-05-16 17:34:56 | <maerwald> | so when ppl talk about typesafety in SQL, what they actually mean most of the time is mapping their backend types into SQL types |
| 2021-05-16 17:35:35 | × | cfricke quits (~cfricke@unaffiliated/cfricke) (Ping timeout: 260 seconds) |
| 2021-05-16 17:35:40 | <Uniaika> | or they mean Squeal, at which point I can only comment their soul to whatever divinity they believe in |
| 2021-05-16 17:35:45 | <charukiewicz> | Again, I find this not particularly error prone if you're using Persistent Entity Syntax |
| 2021-05-16 17:35:52 | → | Pickchea joins (~private@unaffiliated/pickchea) |
| 2021-05-16 17:36:06 | <Uniaika> | electricityZZZZ: I don't think there is such a propertu |
| 2021-05-16 17:36:10 | <Uniaika> | *property |
| 2021-05-16 17:36:11 | <maerwald> | I'd much rather write that mapping manually instead of having a bunch of obscure TH and a looot of instances I easily lose overview over |
| 2021-05-16 17:38:21 | <blankhart> | nm looks like the usage is some kind of pure form of dispatching on types https://github.com/gelisam/klister/blob/71c71e6ab768e7e6b43e9402bc127423cd6e562b/examples/which-problem.kl#L25 |
| 2021-05-16 17:38:53 | <charukiewicz> | If you prefer to write 60 lines of boilerplate per table instead of using some TH, that's your decision, but after my experience, I much prefer to use the entity syntax to define my types |
| 2021-05-16 17:40:19 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed) |
| 2021-05-16 17:40:38 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2021-05-16 17:43:10 | <charukiewicz> | and more broadly, marshalling data in and out of Haskell is going to be the most error prone part of your code. I try to keep that hand written code at a minimum, which is why I'm a fan of both persistent entity syntax on the database side and using deriveJSON in Aeson to define my encoders/decoders on the http side |
| 2021-05-16 17:44:09 | × | Khisanth quits (~Khisanth@255.sub-174-197-131.myvzw.com) (Read error: No route to host) |
| 2021-05-16 17:44:18 | → | oxide joins (~lambda@unaffiliated/mclaren) |
| 2021-05-16 17:46:11 | × | elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Read error: Connection reset by peer) |
| 2021-05-16 17:46:11 | × | shailangsa quits (~shailangs@host217-35-224-205.range217-35.btcentralplus.com) (Ping timeout: 240 seconds) |
| 2021-05-16 17:48:12 | <charukiewicz> | The Yesod book gives a good side-by-side as to what the TH generates, and just seeing what's necessary for a 3 column table, I wouldn't recommend anyone write that by hand for their whole database. Here's the relevant bit from the book: https://www.yesodweb.com/book/persistent#persistent_code_generation |
| 2021-05-16 17:49:44 | → | Khisanth joins (~Khisanth@255.sub-174-197-131.myvzw.com) |
| 2021-05-16 17:53:42 | × | tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Remote host closed the connection) |
| 2021-05-16 17:56:29 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-16 17:57:02 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-05-16 17:58:51 | <a6a45081-2b83> | any idea how to convert HashMap to Persistent Entities? |
| 2021-05-16 17:59:26 | × | curiousgay quits (~gay@178.217.208.8) (Ping timeout: 240 seconds) |
| 2021-05-16 18:00:34 | → | idhugo joins (~idhugo@80-62-116-231-mobile.dk.customer.tdc.net) |
| 2021-05-16 18:00:36 | → | cfricke joins (~cfricke@unaffiliated/cfricke) |
| 2021-05-16 18:00:53 | × | Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 246 seconds) |
| 2021-05-16 18:01:14 | × | xenon- quits (~bc817c21@217.29.117.252) (Quit: http://www.okay.uz/) |
| 2021-05-16 18:01:41 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-05-16 18:02:08 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed) |
| 2021-05-16 18:02:18 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 268 seconds) |
| 2021-05-16 18:02:27 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2021-05-16 18:02:30 | → | benin7 joins (~benin@183.82.177.199) |
| 2021-05-16 18:03:15 | × | mouseghost quits (~draco@wikipedia/desperek) (Quit: mew wew) |
| 2021-05-16 18:04:29 | → | kapil_ joins (~kapil@o-k.website) |
| 2021-05-16 18:04:51 | × | benin quits (~benin@183.82.177.199) (Ping timeout: 260 seconds) |
| 2021-05-16 18:04:52 | benin7 | is now known as benin |
| 2021-05-16 18:05:09 | → | curiousgay joins (~gay@178.217.208.8) |
| 2021-05-16 18:06:03 | × | mysterybear quits (333457a3@51.52.87.163) (Ping timeout: 240 seconds) |
| 2021-05-16 18:07:04 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 245 seconds) |
| 2021-05-16 18:07:11 | × | machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 260 seconds) |
| 2021-05-16 18:08:11 | → | plutoniix joins (~q@node-ufy.pool-125-24.dynamic.totinternet.net) |
| 2021-05-16 18:08:24 | × | nicholasbulka quits (~nicholasb@2601:900:4301:da0:b0b3:4831:47cc:ab06) (Remote host closed the connection) |
| 2021-05-16 18:08:56 | × | neiluj quits (~jco@unaffiliated/neiluj) (Ping timeout: 246 seconds) |
| 2021-05-16 18:09:06 | → | nicholasbulka joins (~nicholasb@2601:900:4301:da0:b0b3:4831:47cc:ab06) |
| 2021-05-16 18:10:00 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-05-16 18:10:23 | → | tromp joins (~tromp@dhcp-077-249-230-040.chello.nl) |
| 2021-05-16 18:11:11 | → | guriya joins (a0ee4bcd@unaffiliated/guriya) |
| 2021-05-16 18:11:24 | → | chenin joins (bab72646@186.183.38.70) |
| 2021-05-16 18:11:36 | → | leo_80 joins (~leo@76.209.246.53) |
| 2021-05-16 18:12:18 | × | leo_80 quits (~leo@76.209.246.53) (Remote host closed the connection) |
| 2021-05-16 18:13:27 | × | nicholasbulka quits (~nicholasb@2601:900:4301:da0:b0b3:4831:47cc:ab06) (Ping timeout: 250 seconds) |
| 2021-05-16 18:15:58 | ← | chenin parts (bab72646@186.183.38.70) () |
| 2021-05-16 18:15:59 | → | neiluj joins (~jco@91-167-203-101.subs.proxad.net) |
| 2021-05-16 18:16:01 | × | stree quits (~stree@68.36.8.116) (Ping timeout: 252 seconds) |
| 2021-05-16 18:16:23 | <charukiewicz> | a6a45081-2b83: do you want each KV pair in your HashMap to be its own record in your DB? |
| 2021-05-16 18:17:07 | × | cfricke quits (~cfricke@unaffiliated/cfricke) (Ping timeout: 260 seconds) |
| 2021-05-16 18:17:41 | <a6a45081-2b83> | for e.g. Person {name :: String, age :: Int} then I want f (fromList [("name", "Foo"), ("age", 3)]) == Person "Foo" 3 |
| 2021-05-16 18:17:59 | <a6a45081-2b83> | obviously this is easy to define for few record fields but what if I have lot of them ... |
| 2021-05-16 18:18:50 | → | sheepduck joins (~sheepduck@2607:fea8:2a60:b700::cafd) |
| 2021-05-16 18:18:53 | <a6a45081-2b83> | there are some JSON utilities though: https://hackage.haskell.org/package/persistent-2.13.0.1/docs/Database-Persist.html#g:4 |
| 2021-05-16 18:18:54 | × | ixlun quits (~user@109.249.184.235) (Read error: Connection reset by peer) |
| 2021-05-16 18:19:05 | <a6a45081-2b83> | I am not sure how to use them |
| 2021-05-16 18:19:09 | <geekosaur> | that looks like a type error to me |
| 2021-05-16 18:19:48 | <a6a45081-2b83> | sorry, the actual link is https://hackage.haskell.org/package/persistent-2.13.0.1/docs/Database-Persist-Class.html#g:9 |
| 2021-05-16 18:20:25 | <a6a45081-2b83> | this one in particular: keyValueEntityFromJSON :: (PersistEntity record, FromJSON record) => Value -> Parser (Entity record) |
| 2021-05-16 18:21:57 | × | finn_elija quits (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) (Ping timeout: 240 seconds) |
| 2021-05-16 18:22:23 | → | shailangsa joins (~shailangs@host86-186-177-159.range86-186.btcentralplus.com) |
| 2021-05-16 18:23:10 | × | star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Ping timeout: 252 seconds) |
| 2021-05-16 18:23:53 | × | xcmw quits (~textual@2603-6011-2200-f103-1090-4073-ea46-f74d.res6.spectrum.com) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-16 18:24:21 | → | finn_elija joins (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) |
| 2021-05-16 18:26:10 | → | ixlun joins (~user@109.249.184.235) |
| 2021-05-16 18:27:01 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Ping timeout: 260 seconds) |
| 2021-05-16 18:28:30 | → | stree joins (~stree@68.36.8.116) |
| 2021-05-16 18:28:37 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-05-16 18:29:41 | × | killsushi quits (~killsushi@2607:fea8:3d40:767:a826:23b7:521c:2d11) (Quit: Leaving) |
| 2021-05-16 18:31:41 | × | geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 260 seconds) |
| 2021-05-16 18:31:46 | → | star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) |
| 2021-05-16 18:32:01 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 2021-05-16 18:33:42 | × | rajivr quits (uid269651@gateway/web/irccloud.com/x-vnrovmdtqzryhchz) (Quit: Connection closed for inactivity) |
| 2021-05-16 18:33:44 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 245 seconds) |
| 2021-05-16 18:34:56 | × | neiluj quits (~jco@91-167-203-101.subs.proxad.net) (Remote host closed the connection) |
| 2021-05-16 18:35:11 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds) |
| 2021-05-16 18:35:13 | → | ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net) |
| 2021-05-16 18:38:00 | × | tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Remote host closed the connection) |
| 2021-05-16 18:38:45 | × | rayyyy quits (~nanoz@gateway/tor-sasl/nanoz) (Ping timeout: 240 seconds) |
| 2021-05-16 18:39:59 | → | Alleria joins (~textual@mskresolve-a.mskcc.org) |
| 2021-05-16 18:40:23 | Alleria | is now known as Guest69218 |
| 2021-05-16 18:40:49 | → | notzmv joins (~zmv@unaffiliated/zmv) |
| 2021-05-16 18:41:13 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-05-16 18:41:17 | × | ddellacosta quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 265 seconds) |
| 2021-05-16 18:41:21 | × | notzmv quits (~zmv@unaffiliated/zmv) (Remote host closed the connection) |
| 2021-05-16 18:41:50 | × | Guest53193 quits (~textual@mskresolve-a.mskcc.org) (Ping timeout: 252 seconds) |
| 2021-05-16 18:42:48 | <charukiewicz> | a6a45081-2b83: that function requires your JSON to objects to have "key" and "value" keys |
| 2021-05-16 18:43:17 | → | tromp joins (~tromp@dhcp-077-249-230-040.chello.nl) |
| 2021-05-16 18:43:52 | → | notzmv joins (~zmv@unaffiliated/zmv) |
| 2021-05-16 18:44:16 | × | notzmv quits (~zmv@unaffiliated/zmv) (Remote host closed the connection) |
| 2021-05-16 18:44:24 | × | Guest69218 quits (~textual@mskresolve-a.mskcc.org) (Ping timeout: 252 seconds) |
| 2021-05-16 18:44:52 | <charukiewicz> | I think you're better off writing your own toPersonEntity :: HashMap k v -> Maybe Person |
All times are in UTC.