Logs: freenode/#haskell
| 2020-11-07 18:15:28 | → | jeBois50 joins (56fe0dc8@lfbn-poi-1-804-200.w86-254.abo.wanadoo.fr) |
| 2020-11-07 18:15:58 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-07 18:16:42 | × | jeBois50 quits (56fe0dc8@lfbn-poi-1-804-200.w86-254.abo.wanadoo.fr) (Remote host closed the connection) |
| 2020-11-07 18:17:27 | <motte> | hekkaidekapus: i'm afraid i still don't understand. http://ix.io/2DkX - i get a duplicate instance declaration error |
| 2020-11-07 18:17:29 | → | coot joins (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl) |
| 2020-11-07 18:18:48 | → | Sgeo joins (~Sgeo@ool-18b982ad.dyn.optonline.net) |
| 2020-11-07 18:19:02 | <hekkaidekapus> | motte: Do not define another instance. Could you write out the type of `fmap fromList . list`? |
| 2020-11-07 18:19:43 | <hekkaidekapus> | (Here in the chat) |
| 2020-11-07 18:20:56 | <motte> | Ord a => Decoder a -> Decoder (S.Set a) |
| 2020-11-07 18:20:59 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 258 seconds) |
| 2020-11-07 18:23:13 | <hekkaidekapus> | motte: That type tells you then that you can directly decode a Set. |
| 2020-11-07 18:24:33 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds) |
| 2020-11-07 18:25:06 | <hekkaidekapus> | If you want a mnemonic name for the combinator, write `foo :: Ord a => Decoder a -> Decoder (Set a); foo = fmap fromList . list` |
| 2020-11-07 18:25:35 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-11-07 18:26:29 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-07 18:26:49 | → | mi23523523 joins (~Mi1029384@82.131.37.175.cable.starman.ee) |
| 2020-11-07 18:26:51 | <motte> | hekkaidekapus: sure, but i kind of rely on FromDhall instances, as i have many nested types |
| 2020-11-07 18:27:13 | <motte> | hekkaidekapus: some of which contain Sets |
| 2020-11-07 18:27:39 | <hekkaidekapus> | motte: The remaining part is to write a `Decoder Foo`. Since Foo is a record, check Dhall’s `record`. |
| 2020-11-07 18:29:28 | → | ddellacosta joins (dd@gateway/vpn/mullvad/ddellacosta) |
| 2020-11-07 18:31:31 | <hekkaidekapus> | motte: It will something like `record (MkFoo <$> field "baz" strictText <*> field "bar" setIgnoringDuplicates)`. |
| 2020-11-07 18:31:38 | → | kish` joins (~oracle@unaffiliated/oracle) |
| 2020-11-07 18:31:39 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 256 seconds) |
| 2020-11-07 18:31:43 | × | forell quits (~forell@unaffiliated/forell) (Ping timeout: 246 seconds) |
| 2020-11-07 18:31:48 | → | alp joins (~alp@2a01:e0a:58b:4920:5137:f9fa:ef1d:43eb) |
| 2020-11-07 18:32:50 | <hekkaidekapus> | You can continue the (<*>) as long as there are more fields in your record type. |
| 2020-11-07 18:33:44 | <motte> | hekkaidekapus: at the end of the day i'll still need to write something like `instance FromDhall Foo` and use my newly written decoder there |
| 2020-11-07 18:34:26 | <motte> | hekkaidekapus: i fail to see how this is better than writing an overlapping instance |
| 2020-11-07 18:34:42 | × | kish quits (~oracle@unaffiliated/oracle) (Ping timeout: 265 seconds) |
| 2020-11-07 18:35:10 | × | jamm_ quits (~jamm@unaffiliated/jamm) (Remote host closed the connection) |
| 2020-11-07 18:36:38 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-07 18:36:49 | <hekkaidekapus> | motte: Deriving is not necessary. You will parse directly from Dhall and the result will be a Foo. The parsing happens inside the Decoder. |
| 2020-11-07 18:36:56 | → | chaosmasttter joins (~chaosmast@p200300c4a70b9f0179cc69ad5d026a5b.dip0.t-ipconnect.de) |
| 2020-11-07 18:38:07 | × | perrier-jouet quits (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 2.9) |
| 2020-11-07 18:38:25 | × | mi23523523 quits (~Mi1029384@82.131.37.175.cable.starman.ee) (Quit: Leaving) |
| 2020-11-07 18:38:30 | → | perrier-jouet joins (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
| 2020-11-07 18:39:19 | <hekkaidekapus> | motte: The parsing function will be an f = input foo. |
| 2020-11-07 18:39:31 | grumble | is now known as \x2D |
| 2020-11-07 18:39:36 | → | jamm_ joins (~jamm@unaffiliated/jamm) |
| 2020-11-07 18:40:53 | <motte> | hekkaidekapus: won't i have to write the whole hierarchy of decoders by hand if i'm not using Deriving? |
| 2020-11-07 18:41:37 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 264 seconds) |
| 2020-11-07 18:42:03 | → | jedws joins (~jedws@101.184.150.81) |
| 2020-11-07 18:42:11 | <hekkaidekapus> | motte: Yeah, you are targetting a custom data type and for that, you need to define the full decoders indeed. |
| 2020-11-07 18:42:40 | <[exa]> | *evil me:* generate them with template haskell |
| 2020-11-07 18:42:48 | <[exa]> | *realistic me:* generate them with CPP! |
| 2020-11-07 18:43:20 | <hekkaidekapus> | [exa]: TH is a bit too much at this stage, I think. |
| 2020-11-07 18:44:03 | <motte> | but why do it if i have it all working with deriving already? is defining an overlapping instance considered terrible style or something? |
| 2020-11-07 18:44:26 | × | jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 264 seconds) |
| 2020-11-07 18:44:34 | <geekosaur> | it's a bug waiting to happen |
| 2020-11-07 18:44:37 | → | lawr3nce joins (~lawr3nce@gateway/tor-sasl/lawr3nce) |
| 2020-11-07 18:45:50 | <hekkaidekapus> | motte: What you are talking about is called ‘orphan instances‘. It is usually not a great idea. |
| 2020-11-07 18:46:12 | <hekkaidekapus> | And yes, what geekosaur said about overlapping instances. |
| 2020-11-07 18:46:47 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-07 18:47:17 | <hekkaidekapus> | The instances are orphans when they are defined in a module other than the class where they belong to. |
| 2020-11-07 18:47:36 | <hekkaidekapus> | s/when/because |
| 2020-11-07 18:48:00 | <koz_> | It's not only a bug waiting to happen - it's GHC error vom you can't make sense of that _will_ happen. |
| 2020-11-07 18:48:01 | × | avdb quits (~avdb@ip-83-134-26-133.dsl.scarlet.be) (Quit: WeeChat 2.9) |
| 2020-11-07 18:48:17 | <koz_> | (I know because I've had to handle legacy decisions causing this exact problem several times _just this week_) |
| 2020-11-07 18:48:37 | <koz_> | (because people seem to want to shove type classes into every possible hole) |
| 2020-11-07 18:48:41 | <koz_> | (because reasons I guess) |
| 2020-11-07 18:49:41 | × | Neuromancer quits (~Neuromanc@unaffiliated/neuromancer) (Ping timeout: 265 seconds) |
| 2020-11-07 18:51:29 | <hekkaidekapus> | Second take: The instances are orphan because they are defined in a module other than the one defining the class where they belong to. |
| 2020-11-07 18:51:38 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-11-07 18:51:59 | <motte> | well, i see your point, but i'm pretty reluctant to write a ton of boilerplate just to avoid the orphan instances |
| 2020-11-07 18:52:31 | <monochrom> | https://www.michaelpj.com/blog/2020/10/29/your-orphans-are-fine.html |
| 2020-11-07 18:53:24 | kish` | is now known as snowkish |
| 2020-11-07 18:53:25 | × | gproto23 quits (~gproto23@unaffiliated/gproto23) (Ping timeout: 240 seconds) |
| 2020-11-07 18:55:01 | × | geekosaur quits (82659a09@host154-009.vpn.uakron.edu) (Remote host closed the connection) |
| 2020-11-07 18:56:10 | → | britva joins (~britva@31-10-157-156.cgn.dynamic.upc.ch) |
| 2020-11-07 18:56:10 | <hekkaidekapus> | motte: Now you have enough data about possible gotchas, it’s up to you to make up your mind about the trade-offs you can afford. |
| 2020-11-07 18:56:55 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-07 18:57:14 | <motte> | hekkaidekapus: indeed, thanks for the help |
| 2020-11-07 18:57:28 | <hekkaidekapus> | yw |
| 2020-11-07 18:57:44 | <int-e> | motte: Hmm, Arbitrary instances are a tricky subject :-/ if you put them in your library, you have a QuickCheck dependency for no particularly good reason, but if you don't, other people cannot reuse the ones you've written... and you probably don't want to split up every library into separate packages for the library, its instances for testing, and the testsuite... |
| 2020-11-07 18:57:49 | <int-e> | uhm |
| 2020-11-07 18:57:50 | <int-e> | monochrom: ^^ |
| 2020-11-07 18:59:20 | <int-e> | monochrom: (I know you're not the author of that post. But you brought it up.) |
| 2020-11-07 18:59:34 | → | forell joins (~forell@unaffiliated/forell) |
| 2020-11-07 18:59:54 | <monochrom> | It is not just Arbitrary. |
| 2020-11-07 19:00:49 | <c_wraith> | orphan instances are not a huge problem in code that you don't distribute. You might need to remove/change them when you update dependencies, but it's not like they're going to break someone else's stuff. You own all your risk. But putting them into a library takes a lot more thought. |
| 2020-11-07 19:00:50 | <monochrom> | You define a data type, you publish it in a published library. You would also like to publish the lenses and prisms associated with that data type. |
| 2020-11-07 19:01:02 | <monochrom> | Some authors decided to split. Some didn't. |
| 2020-11-07 19:01:28 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 246 seconds) |
| 2020-11-07 19:01:30 | <monochrom> | In this case I think the majority chose to split, mytype and mytype-lens. |
| 2020-11-07 19:01:30 | <c_wraith> | But yeah, when the data type and class are in different packages, it's really weird to say one must depend on the other and define the instance. |
| 2020-11-07 19:02:33 | → | SupaYoshi joins (~supayoshi@213-10-140-13.fixed.kpn.net) |
| 2020-11-07 19:03:13 | × | berberman quits (~berberman@unaffiliated/berberman) (Ping timeout: 272 seconds) |
| 2020-11-07 19:03:24 | → | berberman_ joins (~berberman@unaffiliated/berberman) |
| 2020-11-07 19:04:05 | → | inosenpai joins (516e7928@cpc78699-glfd7-2-0-cust39.6-2.cable.virginm.net) |
| 2020-11-07 19:05:29 | ← | inosenpai parts (516e7928@cpc78699-glfd7-2-0-cust39.6-2.cable.virginm.net) () |
| 2020-11-07 19:06:23 | × | chaosmasttter quits (~chaosmast@p200300c4a70b9f0179cc69ad5d026a5b.dip0.t-ipconnect.de) (Ping timeout: 272 seconds) |
| 2020-11-07 19:07:05 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-07 19:07:08 | × | ddellacosta quits (dd@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 272 seconds) |
| 2020-11-07 19:08:47 | → | tuple joins (~igloo@c-67-169-78-228.hsd1.ca.comcast.net) |
| 2020-11-07 19:08:54 | × | tuple quits (~igloo@c-67-169-78-228.hsd1.ca.comcast.net) (Client Quit) |
| 2020-11-07 19:10:43 | → | falafel joins (~falafel@2601:247:c400:1390:7811:313f:d0f3:f9f4) |
| 2020-11-07 19:12:24 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 265 seconds) |
| 2020-11-07 19:13:55 | → | zebrag joins (~inkbottle@aaubervilliers-654-1-156-243.w86-212.abo.wanadoo.fr) |
| 2020-11-07 19:14:23 | × | inkbottle quits (~inkbottle@aaubervilliers-654-1-96-22.w86-212.abo.wanadoo.fr) (Ping timeout: 260 seconds) |
| 2020-11-07 19:19:42 | → | cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) |
All times are in UTC.