Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,910 events total
2021-07-31 09:57:58 Guest82 joins (~Guest82@78.155.54.115)
2021-07-31 10:04:57 <Drew[m]> <tomsmeding> "hm, isn't Constraint really..." <- A constraint has kind `Constraint`, `Constraint` has kind `Type`
2021-07-31 10:07:09 <Drew[m]> And `Type` has kind `Type`
2021-07-31 10:07:55 <Drew[m]> But like you can have two values of type `Int` that aren't equal, just because `Constraint` and `Type` have the same kind, that doesn't make them equal types
2021-07-31 10:08:30 azeem joins (~azeem@176.200.234.104)
2021-07-31 10:09:52 × hiruji quits (~hiruji@user/hiruji) (Read error: Connection reset by peer)
2021-07-31 10:10:12 hiruji joins (~hiruji@user/hiruji)
2021-07-31 10:12:45 <Orbstheorem> Where do you usually put your arbitrary instances? With the code (which leads to the main code depending on quickcheck) or in the tests (which leads to orphan instances)?
2021-07-31 10:13:13 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-31 10:13:37 <Orbstheorem> One of my issues is that sometimes I have to declare arbitrary instances for library types (such as URI) and I find myself with orphan instances on my main code :/
2021-07-31 10:13:40 <sshine> Orbstheorem, I don't use Arbitrary. I use forAll / forAllShrink.
2021-07-31 10:14:19 <sshine> (actually, I use Hedgehog, which doesn't have an Arbitrary type class, and where the shrinker comes for free, but it's equivalent to those.)
2021-07-31 10:14:42 × neceve quits (~quassel@2a02:c7f:607e:d600:f762:20dd:304e:4b1f) (Ping timeout: 272 seconds)
2021-07-31 10:15:28 <sshine> Orbstheorem, with Arbitrary instances, either your main library gets a QuickCheck dependency, or you get orphan instances, or you need to wrap each thing you generate once more, which can be impractical for big, recursive data types.
2021-07-31 10:15:45 × azeem quits (~azeem@176.200.234.104) (Read error: Connection reset by peer)
2021-07-31 10:16:31 azeem joins (~azeem@176.200.234.104)
2021-07-31 10:16:32 <sshine> or rather... the last thing isn't really true. if you wrap a data type in one newtype, that newtype's Arbitrary instance can refer to a Gen that refers to other Gens without there having to be Arbitrary instances for every sub-datatype.
2021-07-31 10:16:36 <Orbstheorem> I'm not sure I get the forAll/forAllShrink answer: A `Gen a` instance is still required.
2021-07-31 10:17:22 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds)
2021-07-31 10:17:32 <Orbstheorem> sshine: What do people usually prefer.
2021-07-31 10:17:36 <sshine> Orbstheorem, example: https://github.com/exercism/haskell/pull/843/files#diff-637040c93c07fbca943993ab34b2ee07185c74ebe5417f416621ca16e7e905a7R19
2021-07-31 10:18:45 mastarija_ joins (~mastarija@31.217.8.174)
2021-07-31 10:18:45 <Orbstheorem> Alright, so you write the generators yourself.
2021-07-31 10:19:08 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
2021-07-31 10:19:13 <Orbstheorem> > <@sshine:libera.chat> Roos, with Arbitrary instances, either your main library gets a QuickCheck dependency, or you get orphan instances, or you need to wrap each thing you generate once more, which can be impractical for big, recursive data types.
2021-07-31 10:19:13 <Orbstheorem> * What do people usually prefer?
2021-07-31 10:19:14 <lambdabot> <hint>:1:1: error: parse error on input ‘<@’
2021-07-31 10:19:32 mastarija__ joins (~mastarija@31.217.8.174)
2021-07-31 10:19:48 <Orbstheorem> I personally like just declaring what I need and have quickcheck 'wire' those generators in; yes it's probably one of two lines, but I find it more clean.
2021-07-31 10:20:12 <sshine> Orbstheorem, https://www.fpcomplete.com/blog/quickcheck-hedgehog-validity/ -- here's an article that discusses Arbitrary. and yes, I write the generators. do you know of any projects that derives Gen?
2021-07-31 10:20:46 <sshine> you mean you like to have 'arbitrary :: anything'? yeah, I think it is really cool :) but not always practical.
2021-07-31 10:20:55 <Orbstheorem> Thanks for the article ^^
2021-07-31 10:22:01 <sshine> e.g. what if you, for one type, want to test multiple things where the values are generated differently? e.g. I have a parser for scientific numbers, and one of the properties is "can it handle the full syntactic range?" -- and another is, does it handle precision? for the second property, a lot of the "full syntactic range" values wouldn't come close to the point of interest wrt. precision.
2021-07-31 10:22:11 × mastarija quits (~mastarija@31.217.8.174) (Ping timeout: 252 seconds)
2021-07-31 10:22:21 <sshine> so my experience is that I can't assume there to be one canonical generator for each type.
2021-07-31 10:22:35 <Orbstheorem> What I mean is that I like stuff like this: `prop_foobar :: OneType -> SecondType -> Property`
2021-07-31 10:22:38 <sshine> or even, very often, a generally useful one.
2021-07-31 10:23:01 <sshine> Orbstheorem, yeah, that part seems really nice :) sort of like DI.
2021-07-31 10:23:34 × mastarija_ quits (~mastarija@31.217.8.174) (Ping timeout: 272 seconds)
2021-07-31 10:24:30 <Orbstheorem> Yes, I'm not saying I never use `forAll` myself, rather than most of the times, very dump (Arbitrary) generators do the job, and I'd rather not have the overhead of writing `forAll genOneType $ ...`.
2021-07-31 10:25:22 <sshine> the overhead of Arbitrary is specifying a newtype and its Arbitrary instance for every kind of thing you want to generate, as opposed to writing 'genOneType'.
2021-07-31 10:25:22 × Vajb quits (~Vajb@2001:999:62:1d53:26b1:6c9b:c1ed:9c01) (Read error: Connection reset by peer)
2021-07-31 10:26:23 <sshine> in my experience, the overhead of the different approaches is comparable, and depends mostly on how much you manage to re-use your Arbitrary instances. and the thing you like is to have Arbitrary values injected into your property test, as opposed to specifying them as Gen values. which I do think is a killer feature, but also not worth it. :P
2021-07-31 10:26:37 Vajb joins (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi)
2021-07-31 10:28:09 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-07-31 10:29:16 × euouae quits (~euouae@user/euouae) (Ping timeout: 246 seconds)
2021-07-31 10:32:58 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 240 seconds)
2021-07-31 10:33:42 × waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 272 seconds)
2021-07-31 10:34:04 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-31 10:35:50 <sshine> Orbstheorem, https://github.com/sshine/hs-jq/blob/master/test/ParserTest.hs#L335 <- here's a test that depends on a generator that only generates strings with certain unicode symbols in it. with Arbitrary I'd have to create a newtype that doesn't get re-used. I might re-use the generator inside a full-coverage generator, but I probably wouldn't re-use the Arbitrary instance for that.
2021-07-31 10:41:18 × mastarija__ quits (~mastarija@31.217.8.174) (Ping timeout: 272 seconds)
2021-07-31 10:41:32 × azeem quits (~azeem@176.200.234.104) (Ping timeout: 252 seconds)
2021-07-31 10:43:57 nate3 joins (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net)
2021-07-31 10:48:53 × nate3 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 258 seconds)
2021-07-31 10:53:15 <Orbstheorem> I'm under the impression I may have misexpressed myself: I'm not criticizing the use of `forAll` (in fact, I very often use it myself), so saying that `forAll` and Arbitrary don't play well toguether, I'm simply advocating for Arbitrary instances for types that already exist in the code. I am not advocating for wrapping stuff in newtypes just for the fun of creating an Arbitrary instance.
2021-07-31 10:53:22 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 240 seconds)
2021-07-31 10:53:59 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-31 10:55:07 <Orbstheorem> `deriving stock (Generic); deriving anyclass (Arbitrary)` is very clean for many of my instances, my original question expressed my concern between depending on QuickCheck on the main code or having orphan instances in the tests (either by empty implementation or standalone deriving).
2021-07-31 11:02:28 × burnsidesLlama quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Remote host closed the connection)
2021-07-31 11:05:51 × Gurkenglas quits (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) (Remote host closed the connection)
2021-07-31 11:06:10 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 240 seconds)
2021-07-31 11:06:12 Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de)
2021-07-31 11:06:32 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-31 11:07:57 AlexNoo_ joins (~AlexNoo@178.34.150.193)
2021-07-31 11:08:04 pe200012 joins (~pe200012@113.105.10.33)
2021-07-31 11:09:54 × Alex_test quits (~al_test@94.233.241.173) (Ping timeout: 256 seconds)
2021-07-31 11:10:32 × AlexZenon quits (~alzenon@94.233.241.173) (Ping timeout: 245 seconds)
2021-07-31 11:11:12 × jmorris quits (uid433911@id-433911.stonehaven.irccloud.com) (Quit: Connection closed for inactivity)
2021-07-31 11:11:29 euouae joins (~euouae@user/euouae)
2021-07-31 11:11:38 × AlexNoo quits (~AlexNoo@94.233.241.173) (Ping timeout: 250 seconds)
2021-07-31 11:11:48 <sshine> Orbstheorem, https://www.michaelpj.com/blog/2020/10/29/your-orphans-are-fine.html
2021-07-31 11:12:00 × pe200012 quits (~pe200012@113.105.10.33) (Client Quit)
2021-07-31 11:12:20 × Gurkenglas quits (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) (Ping timeout: 272 seconds)
2021-07-31 11:14:18 jmorris joins (uid433911@id-433911.stonehaven.irccloud.com)
2021-07-31 11:14:54 AlexZenon joins (~alzenon@178.34.150.193)
2021-07-31 11:14:55 Alex_test joins (~al_test@178.34.150.193)
2021-07-31 11:21:03 acidjnk_new joins (~acidjnk@p200300d0c72b9501c19bd88441742b9a.dip0.t-ipconnect.de)
2021-07-31 11:24:26 × acidjnk quits (~acidjnk@p200300d0c72b9576e9974425ad52911e.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
2021-07-31 11:30:00 × stenvold quits (~stenvold@2001:a61:25f1:6701:a993:a914:786f:a6f5) (Quit: Client closed)
2021-07-31 11:32:25 × dunj3 quits (~dunj3@2001:981:9d95:1:886d:656c:9636:23f4) (Quit: Leaving)
2021-07-31 11:38:59 burnsidesLlama joins (~burnsides@dhcp168-019.wadham.ox.ac.uk)
2021-07-31 11:40:29 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-31 11:40:49 lavaman joins (~lavaman@98.38.249.169)
2021-07-31 11:44:53 × burnsidesLlama quits (~burnsides@dhcp168-019.wadham.ox.ac.uk) (Ping timeout: 265 seconds)
2021-07-31 11:45:54 × lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 272 seconds)
2021-07-31 11:50:26 mastarija__ joins (~mastarija@31.217.8.174)
2021-07-31 11:50:29 deejaytee joins (~deejaytee@cpc91196-cmbg18-2-0-cust215.5-4.cable.virginm.net)
2021-07-31 11:50:40 MoC joins (~moc@user/moc)
2021-07-31 11:52:10 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 240 seconds)
2021-07-31 11:53:13 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-31 12:01:35 tommd joins (~tommd@cpe-76-179-204-251.maine.res.rr.com)
2021-07-31 12:01:36 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer)
2021-07-31 12:02:09 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-07-31 12:12:35 × mastarija__ quits (~mastarija@31.217.8.174) (Quit: Leaving)
2021-07-31 12:12:35 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer)
2021-07-31 12:13:08 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
2021-07-31 12:14:58 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds)
2021-07-31 12:14:58 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-31 12:15:09 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-31 12:17:37 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)

All times are in UTC.