Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 608 609 610 611 612 613 614 615 616 617 618 .. 5022
502,152 events total
2020-10-13 09:27:00 <jonathanx> Thank you!
2020-10-13 09:29:37 <sshine> I'd probably go with JSON. :-D
2020-10-13 09:30:03 <dminuoso> JSON is webscale.
2020-10-13 09:30:12 <sshine> what does webscale mean?
2020-10-13 09:30:35 <dminuoso> sshine: https://www.youtube.com/watch?v=b2F-DItXtZs
2020-10-13 09:30:42 <sshine> I see JSON more like a common serializable format. short path between two command-line programs to share structured data.
2020-10-13 09:31:46 is_null joins (~jpic@pdpc/supporter/professional/is-null)
2020-10-13 09:32:17 <dminuoso> Superficially, JSON only solves the "how do I serialize numbers (that's a funny bit, btw), strings, dictionaries, lists and bools" part.
2020-10-13 09:32:28 dhouthoo_ joins (~dhouthoo@ptr-eiv6509pb4ifhdr9lsd.18120a2.ip6.access.telenet.be)
2020-10-13 09:32:28 <sshine> dminuoso, it sounds like tacking "web scale" onto something means you disapprove of it because of premature scaling concerns. :)
2020-10-13 09:32:40 <sshine> s/only // and I'm with you.
2020-10-13 09:32:48 <dminuoso> sshine: There's a lot of tongue-in-cheek in the webscale remark, above.
2020-10-13 09:32:53 <sshine> yeah
2020-10-13 09:33:02 <sshine> I think JSON is quite unambitious, which is a good thing.
2020-10-13 09:33:16 <dminuoso> The thing is, when you're getting a deserialized JSON, you still have to parse the structure of it.
2020-10-13 09:33:28 × dhouthoo quits (~dhouthoo@178-117-36-167.access.telenet.be) (Ping timeout: 246 seconds)
2020-10-13 09:33:34 <dminuoso> Much of Python code is more adhoc, and destructures the data all over the place.
2020-10-13 09:34:14 ubert joins (~Thunderbi@2a02:8109:9880:303c:ca5b:76ff:fe29:f233)
2020-10-13 09:34:26 <dminuoso> Since JSON types can be mapped into equally unstructured Python data.
2020-10-13 09:34:36 <sshine> so, my idea is, you have a bunch of ADTs, you derive Aeson encode/decode, and you save your configs to disk. if you need to interact with them in *any other way*, serialization is given. if not, you can post-pone deriving Aeson.
2020-10-13 09:34:54 <sshine> so no web scale ambition here. :)
2020-10-13 09:35:18 × L29Ah quits (~L29Ah@unaffiliated/l29ah) (Ping timeout: 260 seconds)
2020-10-13 09:36:50 <sshine> they're not as safe as GADTs with phantom types, but they serialize nicely, which is something I'd probably appreciate sooner. :)
2020-10-13 09:42:28 × karolus quits (~karolus@static.32.230.217.95.clients.your-server.de) (Ping timeout: 256 seconds)
2020-10-13 09:42:37 <gentauro> jonathanx: why not just to `show` / `read`?
2020-10-13 09:43:12 <gentauro> jonathanx: I have started to use that (with pretty-print) instead of `JSON`
2020-10-13 09:43:33 <gentauro> It's more readable and it's easily save/load -able
2020-10-13 09:43:34 <Uniaika> hey folks, I'm having a bit of an issue with Aeson. Do you know how I can write a `ToJSON MySumType` instance that would write the two members of the sum type as separate keys in the top-most object?
2020-10-13 09:43:44 <Uniaika> because I could write them in a sub-object
2020-10-13 09:44:01 <Uniaika> but due to reasons like backward compatibility, this is hardly an option :/
2020-10-13 09:44:30 perrier-jouet joins (~perrier-j@modemcable012.251-130-66.mc.videotron.ca)
2020-10-13 09:46:09 <jonathanx> Well, if I were to use json, then I'd have to somehow serialize the phantom types (representing them in the json), and validate them on deserialization. This would leave me open to pretty mauch the same range of errors I'd get if I just enforced the invariants using runtime checks
2020-10-13 09:46:29 <gentauro> dminuoso: that `webscale` video made my day. It's actually a documentary, cos that moment (2:35) I had far to many times … (it's like they are "quoting me") :o
2020-10-13 09:48:08 <jonathanx> which would turn the entire phantom type based invariant forcing into just a piece of redundant bloat/an excessive roundtrip
2020-10-13 09:48:20 <gentauro> Uniaika: I tend to use `set <|> bin` (`Control.Applicative` Alternate) for that
2020-10-13 09:48:59 <gentauro> I can post code that does exactly what you are asking for, but I'm working on the proejct at this exact moment :)
2020-10-13 09:49:07 <gentauro> s/I can/I can't/
2020-10-13 09:51:27 <gentauro> kindaro: `please write to me offline` Roger that
2020-10-13 09:51:37 acidjnk_new joins (~acidjnk@p200300d0c723782835a5fda97218b164.dip0.t-ipconnect.de)
2020-10-13 09:53:27 <Uniaika> gentauro: oh, thank you :)
2020-10-13 09:56:45 shatriff_ joins (~vitaliish@176.52.219.10)
2020-10-13 09:56:45 × shatriff quits (~vitaliish@176.52.219.10) (Read error: Connection reset by peer)
2020-10-13 09:56:46 <dminuoso> Uniaika: You could always just write the object out by hand `object ["foo" .= foo, "bar" .= bar]`, Ive grown quite fond of that.
2020-10-13 09:56:51 supercoven joins (~Supercove@dsl-hkibng32-54fb54-166.dhcp.inet.fi)
2020-10-13 09:57:27 <dminuoso> Too often I found, relying on generics, generics with options, and things like the Alternative, is trying very hard to take indirect control over the encoder/decoder
2020-10-13 09:57:35 <kuribas> Uniaika: do you need to rewrite the Aeson?
2020-10-13 09:57:47 <kuribas> Uniaika: I actually just wrote code to do that.
2020-10-13 09:57:58 <kuribas> Uniaika: and you can still use generics after it.
2020-10-13 09:59:23 <dminuoso> Also, with generics you're tying external representation directly to your data types. To get around that, you might start having a separate data type, where you rename fields particularly to control the representation, and then you need a sort of `fromRep/toRep` functions, which is the exact boilerplate you tried to avoid in the first place..
2020-10-13 09:59:29 <kuribas> Uniaika: https://gist.github.com/kuribas/5c617ecf025ccb37467a23556cbe963e
2020-10-13 09:59:35 <dminuoso> Every time I stare at aeson, I dont think generics are a good idea. :(
2020-10-13 09:59:40 <dminuoso> Or typeclasses at all
2020-10-13 10:00:06 <kuribas> there are many times where generics are actually desirable.
2020-10-13 10:00:17 <Uniaika> thanks to you all :)
2020-10-13 10:00:24 ensyde joins (~ensyde@2600:1702:2e30:1a40:f09c:a012:516e:b253)
2020-10-13 10:00:30 <kuribas> because you know it will still be consistent when you add a field.
2020-10-13 10:00:41 <kuribas> while manual instance don't garantee that your instances are consistent.
2020-10-13 10:01:00 <Uniaika> kuribas: I have a roundtrip test for that
2020-10-13 10:01:11 <Uniaika> always with manual instances for Aeson and pg-simple
2020-10-13 10:01:14 <kuribas> Uniaika: with my code it is actually garanteed
2020-10-13 10:01:16 akegalj joins (~akegalj@93-138-183-8.adsl.net.t-com.hr)
2020-10-13 10:01:34 <kuribas> Uniaika: as long as you use the same options of course.
2020-10-13 10:01:49 <Uniaika> kuribas: I'm waiting for a blog post to introduce that AesonTrans :)
2020-10-13 10:01:52 × dhouthoo_ quits (~dhouthoo@ptr-eiv6509pb4ifhdr9lsd.18120a2.ip6.access.telenet.be) (Ping timeout: 244 seconds)
2020-10-13 10:01:58 <Uniaika> it really looks interesting :)
2020-10-13 10:01:58 <kuribas> Uniaika: I should make a library for it...
2020-10-13 10:02:03 <Uniaika> also! :D
2020-10-13 10:03:09 <kuribas> Uniaika: the disadvantage is that it rewrites the Value, so it is less efficient than a direct toEncoding.
2020-10-13 10:04:27 hackage Z-IO 0.1.5.1 - Simple and high performance IO toolkit for Haskell https://hackage.haskell.org/package/Z-IO-0.1.5.1 (winterland)
2020-10-13 10:04:35 dhouthoo_ joins (~dhouthoo@ptr-eiv6509pb4ifhdr9lsd.18120a2.ip6.access.telenet.be)
2020-10-13 10:04:57 <kuribas> Uniaika: fromField (Proxy @"field") ["a", "b"] "c", pulls in field c, for example {"a": {"b": {"c" = 2 }}} => {"field" => 2}
2020-10-13 10:05:02 × ensyde quits (~ensyde@2600:1702:2e30:1a40:f09c:a012:516e:b253) (Ping timeout: 260 seconds)
2020-10-13 10:06:13 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds)
2020-10-13 10:06:46 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-10-13 10:07:02 <kuribas> Uniaika: maybeFromField does the same, but can be empty.
2020-10-13 10:07:44 <kuribas> Uniaika: you can compose the AesonTrans with monoid, use postTransJSON and preTransJSON to translate the JSON. That's it basically.
2020-10-13 10:07:52 × guest35 quits (d537f42e@213.55.244.46) (Remote host closed the connection)
2020-10-13 10:08:14 <kuribas> Uniaika: and don't forget to set the fieldModifier using transFieldModifier if you have one.
2020-10-13 10:09:06 × lemmih_ quits (~lemmih@218.186.157.57) (Remote host closed the connection)
2020-10-13 10:09:34 lemmih_ joins (~lemmih@2406:3003:2072:44:9dc:f2e9:a002:8d1a)
2020-10-13 10:09:55 <Uniaika> kuribas: I doubt I'll be able to pull this off for the current project, but I will definitely think about it for any next project I'm bootstrapping
2020-10-13 10:10:08 <Uniaika> (but again, I'll need some kind of blog post to introduce the lib and its usage :P)
2020-10-13 10:10:33 <kuribas> Uniaika: yeah, a hackage library with some docs would be a good idea :)
2020-10-13 10:10:44 × cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 2.9)
2020-10-13 10:10:46 <Uniaika> <3
2020-10-13 10:13:18 × is_null quits (~jpic@pdpc/supporter/professional/is-null) (Ping timeout: 272 seconds)
2020-10-13 10:13:53 is_null joins (~jpic@pdpc/supporter/professional/is-null)
2020-10-13 10:15:30 karolus joins (~karolus@static.32.230.217.95.clients.your-server.de)
2020-10-13 10:16:50 × proofofme quits (~proofofme@184-96-74-65.hlrn.qwest.net) (Remote host closed the connection)
2020-10-13 10:17:50 cfricke joins (~cfricke@unaffiliated/cfricke)
2020-10-13 10:18:49 × is_null quits (~jpic@pdpc/supporter/professional/is-null) (Ping timeout: 264 seconds)
2020-10-13 10:21:27 oisdk joins (~oisdk@2001:bb6:3329:d100:7c51:293a:6844:5080)
2020-10-13 10:21:47 × polyrain_ quits (~polyrain@2001:8003:e501:6901:8a4:c02:960d:e633) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-10-13 10:22:15 L29Ah joins (~L29Ah@unaffiliated/l29ah)
2020-10-13 10:22:52 phillip joins (~phillip@178.162.204.214)
2020-10-13 10:23:46 × wei2912 quits (~wei2912@unaffiliated/wei2912) (Quit: Lost terminal)
2020-10-13 10:24:06 × lemmih_ quits (~lemmih@2406:3003:2072:44:9dc:f2e9:a002:8d1a) (Remote host closed the connection)
2020-10-13 10:24:08 × iteratee quits (~kyle@162.211.154.4) (Read error: Connection reset by peer)
2020-10-13 10:24:20 iteratee joins (~kyle@162.211.154.4)
2020-10-13 10:24:31 × petersen quits (~petersen@redhat/juhp) (Remote host closed the connection)

All times are in UTC.