Newest at the top
2025-03-13 13:19:51 +0100 | <dminuoso> | Yes, so? |
2025-03-13 13:19:41 +0100 | <tomsmeding> | dminuoso: toJSON is a method of ToJSON. |
2025-03-13 13:19:12 +0100 | <dminuoso> | tomsmeding: `toJSON :: YourThing -> Value` - you do not have to attach this to a typeclass for this to work. |
2025-03-13 13:19:10 +0100 | <tomsmeding> | you can even have only one newtype, and give it a phantom parameter that indicates the particular (de)serialisation you want ;) |
2025-03-13 13:18:50 +0100 | <tomsmeding> | especially if some external dependency requires you to use the classes, use newtype wrappers |
2025-03-13 13:18:18 +0100 | igemnace | (~igemnace@user/igemnace) igemnace |
2025-03-13 13:17:50 +0100 | __monty__ | (~toonn@user/toonn) toonn |
2025-03-13 13:17:47 +0100 | <Square2> | dminuoso, what do you suggest instead? I use the OpenApi dependency which seems to require me to use Aeson instances. |
2025-03-13 13:17:38 +0100 | <tomsmeding> | dminuoso: what to do instead? |
2025-03-13 13:17:17 +0100 | df | (~ben@justworks.xyz) |
2025-03-13 13:17:02 +0100 | <dminuoso> | They are a rather poor fit for de/-serialization precisely for reasons like you just encountered. |
2025-03-13 13:16:46 +0100 | <dminuoso> | Just dont use typeclass machinery. |
2025-03-13 13:16:44 +0100 | df | (~ben@justworks.xyz) (Ping timeout: 260 seconds) |
2025-03-13 13:16:38 +0100 | <dminuoso> | Square2: You are not forced to use FromJSON/ToJSON |
2025-03-13 13:16:35 +0100 | <tomsmeding> | this is what makes the Data.Set / Data.Map API work, for example: if you could pass the same Map between different modules with different Ord instances on the key in scope, you'll severly break the internal invariants of the Map data structure |
2025-03-13 13:16:21 +0100 | <Square2> | Ah ok. I thought it could work with careful arrangement of things, but I could see it becoming real troublesome |
2025-03-13 13:16:03 +0100 | <tomsmeding> | and furthermore it breaks the general assumption in haskell that typeclass instances are confluent, which is precisely the assumption that any particular class - type combination has at most _one_ instance |
2025-03-13 13:15:39 +0100 | unlucy | (sid572875@user/unlucy) unlucy |
2025-03-13 13:15:29 +0100 | jakesyl_____ | (sid56879@id-56879.hampstead.irccloud.com) |
2025-03-13 13:15:27 +0100 | <tomsmeding> | having two different instances of the same class for the same type in different modules is a recipe for trouble |
2025-03-13 13:15:23 +0100 | astra | (sid289983@id-289983.hampstead.irccloud.com) |
2025-03-13 13:15:19 +0100 | meinside | (uid24933@id-24933.helmsley.irccloud.com) meinside |
2025-03-13 13:15:14 +0100 | rune_ | (sid21167@id-21167.ilkley.irccloud.com) |
2025-03-13 13:15:11 +0100 | <tomsmeding> | (and also re-export them automatically) |
2025-03-13 13:15:08 +0100 | unlucy | (sid572875@user/unlucy) (Read error: Connection reset by peer) |
2025-03-13 13:15:08 +0100 | meinside | (uid24933@id-24933.helmsley.irccloud.com) (Read error: Connection reset by peer) |
2025-03-13 13:15:06 +0100 | astra | (sid289983@user/amish) (Read error: Connection reset by peer) |
2025-03-13 13:15:06 +0100 | rune_ | (sid21167@id-21167.ilkley.irccloud.com) (Read error: Connection reset by peer) |
2025-03-13 13:15:03 +0100 | <tomsmeding> | Square2: instances are viral -- you can't choose to _not_ export them, and if you import them, you inherit them automatically |
2025-03-13 13:14:59 +0100 | jakesyl_____ | (sid56879@id-56879.hampstead.irccloud.com) (Ping timeout: 260 seconds) |
2025-03-13 13:14:53 +0100 | igemnace | (~igemnace@user/igemnace) (Remote host closed the connection) |
2025-03-13 13:14:44 +0100 | SethTisue | (sid14912@id-14912.ilkley.irccloud.com) |
2025-03-13 13:14:42 +0100 | geekosaur | (sid609282@xmonad/geekosaur) geekosaur |
2025-03-13 13:14:42 +0100 | bradparker | (sid262931@id-262931.uxbridge.irccloud.com) bradparker |
2025-03-13 13:14:35 +0100 | SethTisue | (sid14912@id-14912.ilkley.irccloud.com) (Read error: Connection reset by peer) |
2025-03-13 13:14:32 +0100 | geekosaur | (sid609282@xmonad/geekosaur) (Read error: Connection reset by peer) |
2025-03-13 13:14:30 +0100 | bradparker | (sid262931@id-262931.uxbridge.irccloud.com) (Read error: Connection reset by peer) |
2025-03-13 13:13:34 +0100 | k_hachig_ | (~k_hachig@2607:fea8:351d:ef0:a56d:37e8:f63c:429c) k_hachig |
2025-03-13 13:09:59 +0100 | weary-traveler | (~user@user/user363627) user363627 |
2025-03-13 13:07:03 +0100 | __monty__ | (~toonn@user/toonn) (Ping timeout: 245 seconds) |
2025-03-13 13:06:49 +0100 | <Square2> | Jack, Oh thanks. Just curious, why? Too hard to keep all imports in your head? |
2025-03-13 13:06:44 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) lortabac |
2025-03-13 13:06:30 +0100 | merijn | (~merijn@77.242.116.146) (Ping timeout: 276 seconds) |
2025-03-13 13:04:38 +0100 | <haskellbridge> | <Jack> Square2: I’d suggest newtype trickery. |
2025-03-13 13:03:34 +0100 | comerijn | (~merijn@77.242.116.146) merijn |
2025-03-13 13:00:04 +0100 | infohazards | (~user@user/fmira) fmira |
2025-03-13 12:59:17 +0100 | infohazards | (~user@user/fmira) (Remote host closed the connection) |
2025-03-13 12:54:34 +0100 | alfiee | (~alfiee@user/alfiee) (Ping timeout: 260 seconds) |
2025-03-13 12:49:53 +0100 | alfiee | (~alfiee@user/alfiee) alfiee |
2025-03-13 12:41:38 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Ping timeout: 248 seconds) |