Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-16 16:06:32 × p-core quits (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515) (Remote host closed the connection)
2020-11-16 16:06:35 <dminuoso> https://hackage.haskell.org/package/optics-core-0.3.0.1/docs/Optics-Internal-Optic-Subtyping.html#t:Join
2020-11-16 16:06:48 <dminuoso> And https://hackage.haskell.org/package/optics-core-0.3.0.1/docs/Optics-Internal-Optic.html#v:castOptic
2020-11-16 16:06:49 × idhugo quits (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net) (Ping timeout: 264 seconds)
2020-11-16 16:07:04 justsomeguy joins (~justsomeg@2603:9000:960a:fc00:c4d2:5b73:c7b7:3a2b)
2020-11-16 16:07:04 × justsomeguy quits (~justsomeg@2603:9000:960a:fc00:c4d2:5b73:c7b7:3a2b) (Changing host)
2020-11-16 16:07:04 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
2020-11-16 16:07:21 <dminuoso> (It's very boilerplaty, but it works because the hierarchy is pretty much fixed in size.)
2020-11-16 16:09:09 × bahamas quits (~lucian@unaffiliated/bahamas) (Quit: leaving)
2020-11-16 16:10:05 <kuribas> dminuoso: actually, that should work for my case!
2020-11-16 16:10:34 mirrorbird joins (~psutcliff@89.40.182.152)
2020-11-16 16:11:05 <kuribas> I don't even need type families IMO...
2020-11-16 16:11:46 × avdb quits (~avdb@ip-62-235-12-238.dsl.scarlet.be) (Ping timeout: 256 seconds)
2020-11-16 16:11:56 <dminuoso> Depends on what your goals are. Here, the Join type family is useful because if you compose two optics, the resulting optic is their least upper bound
2020-11-16 16:12:13 <dminuoso> (i.e. A_Prism composed with A_Lens gives you An_AffineFold)
2020-11-16 16:12:40 idhugo joins (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net)
2020-11-16 16:13:42 × zfnmxt quits (~zfnmxt@unaffiliated/zfnmxt) (Quit: Bye!)
2020-11-16 16:13:50 <kuribas> instance IsA k k; IsA MySubClass b => instance IsA b MyClass
2020-11-16 16:14:30 <kuribas> ah no, that's overlapping...
2020-11-16 16:14:32 zfnmxt joins (~zfnmxt@unaffiliated/zfnmxt)
2020-11-16 16:21:59 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-11-16 16:22:12 × xff0x quits (~fox@2001:1a81:529e:a500:a7e0:336:a54e:d7a5) (Ping timeout: 260 seconds)
2020-11-16 16:22:24 lottaquestions_ joins (~nick@2607:fa49:5040:d100:54ba:4f0:c193:a93d)
2020-11-16 16:22:43 × mirrorbird quits (~psutcliff@89.40.182.152) (Quit: Leaving)
2020-11-16 16:22:52 xff0x joins (~fox@2001:1a81:529e:a500:93fd:46ff:4df5:fd50)
2020-11-16 16:24:01 lottaquestions_ parts (~nick@2607:fa49:5040:d100:54ba:4f0:c193:a93d) ("Konversation terminated!")
2020-11-16 16:24:31 cads2 joins (~cads@ip-64-72-99-232.lasvegas.net)
2020-11-16 16:25:03 Sgeo_ joins (~Sgeo@ool-18b982ad.dyn.optonline.net)
2020-11-16 16:27:25 × Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 240 seconds)
2020-11-16 16:28:25 × Sgeo quits (~Sgeo@ool-18b982ad.dyn.optonline.net) (Ping timeout: 264 seconds)
2020-11-16 16:29:58 <tomjaguarpaw> Hmm, so according to getRTSStats GC is taking a lot (80%) of the time of the function I want to benchmark
2020-11-16 16:30:20 <kuribas> dminuoso: nevermind, these are generated, I could as well generate instance for every possible superclass.
2020-11-16 16:30:24 <tomjaguarpaw> Well, about 3% for small input data and 80% for large input data (the input data are expression trees)
2020-11-16 16:31:04 <Uniaika> tomjaguarpaw: :o
2020-11-16 16:31:27 <dminuoso> kuribas: Im not telling you this is how you should do it, just as an inspiration perhaps.
2020-11-16 16:31:43 <dminuoso> The underlying implementation works because the inheritance is given by constraint mixing.
2020-11-16 16:32:00 <dminuoso> (So castOptic relies on constraint implications to work properly)
2020-11-16 16:33:01 <dminuoso> class Is k l where implies :: (Constraints k p => r) -> (Constraints l p => r)
2020-11-16 16:33:12 <kuribas> dminuoso: looks complicated ...
2020-11-16 16:33:34 <dminuoso> kuribas: Well the idea is rather simple really
2020-11-16 16:33:46 <Uniaika> tomjaguarpaw: would you need mutable datastructures?
2020-11-16 16:34:04 <dminuoso> kuribas: Handwavingly, an optic is something of type: type Optic c s t a b = forall p. c p => p a b -> p s t
2020-11-16 16:34:07 <kuribas> dminuoso: so my solution would verbose but simple: data SomeClass; instance IsSubClass SomeClass SuperClass; instance IsSubClass SomeClass SuperClassOfSuperClass
2020-11-16 16:34:12 <dminuoso> Where c is some constraints
2020-11-16 16:34:24 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 272 seconds)
2020-11-16 16:34:32 × chele quits (~chele@ip5b416ea2.dynamic.kabel-deutschland.de) (Remote host closed the connection)
2020-11-16 16:34:54 <dminuoso> So `type Lens s t a b = forall p. Strong p => p a b -> p s t`
2020-11-16 16:35:12 <dminuoso> And `type Prism s t a b = forall p. Choice p => p a b -> p s t`
2020-11-16 16:35:28 <kuribas> for a funny definition of "simple"
2020-11-16 16:35:31 <dminuoso> Hold on!
2020-11-16 16:35:54 <kuribas> dminuoso: you don't need to convince me, this is meant for haskell newbees.
2020-11-16 16:36:12 <dminuoso> `type AffineTraversal s t a b = forall p. Visiting p => p a b -> p s t`
2020-11-16 16:36:13 avdb joins (~avdb@ip-213-49-61-183.dsl.scarlet.be)
2020-11-16 16:36:16 <dminuoso> kuribas: The idea now is:
2020-11-16 16:36:49 <dminuoso> Strong and Choice give you Visiting.
2020-11-16 16:38:07 <dminuoso> Because: class (Choice p, Strong p) => Visiting p
2020-11-16 16:39:18 electricityZZZZ joins (~electrici@108-216-157-17.lightspeed.sntcca.sbcglobal.net)
2020-11-16 16:41:48 × machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 256 seconds)
2020-11-16 16:43:01 <dminuoso> kuribas: *sorry there was a typo. The other way around, Visibility implies Choice and Strong.
2020-11-16 16:43:40 × idhugo quits (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net) (Read error: Connection reset by peer)
2020-11-16 16:43:42 Tuplanolla joins (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi)
2020-11-16 16:44:13 idhugo joins (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net)
2020-11-16 16:44:15 <kuribas> dminuoso: that's hardly easy...
2020-11-16 16:44:19 <dminuoso> So if you plug in something that gives Visiting, then you can also treat this as Choice and Strong
2020-11-16 16:44:46 <kuribas> I just feel that most of what is in lens is fluff
2020-11-16 16:44:50 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-11-16 16:44:50 × da39a3ee5e6b4b0d quits (~da39a3ee5@cm-171-98-76-220.revip7.asianet.co.th) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-11-16 16:44:58 <kuribas> it's nice, and cool it's possible, but not that necessary
2020-11-16 16:45:19 <kuribas> there's a small core which is very useful, like lenses, prisms, traversals
2020-11-16 16:48:40 × vacm quits (~vacwm@70.23.92.191) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-11-16 16:49:34 nbloomf joins (~nbloomf@2600:1700:ad14:3020:8491:5fed:8d7f:daad)
2020-11-16 16:50:06 conal joins (~conal@64.71.133.70)
2020-11-16 16:50:10 <tomjaguarpaw> Uniaika: I'm not sure what you mean "Would I need mutable datastructures". Everything I am doing is without mutation
2020-11-16 16:50:21 <kuribas> dminuoso: if I want to put emphasis on the benefits of haskell to a non-haskell programmer, and I show them this, they think I am crazy.
2020-11-16 16:50:24 <tomjaguarpaw> Are you saying mutable data structures could cause less garbage?
2020-11-16 16:51:19 <merijn> tomjaguarpaw: Are you, by any chance, using the threaded runtime system?
2020-11-16 16:51:25 <Uniaika> tomjaguarpaw: well, if you're applying a lot of transformations on an immutable datastructure, it produces a lot of garbage, right?
2020-11-16 16:51:27 <tomjaguarpaw> Not knowingly
2020-11-16 16:51:40 <merijn> Uniaika: That's not really relevant, though
2020-11-16 16:51:43 <tomjaguarpaw> I don't have "-threaded" in my cabal file
2020-11-16 16:51:46 <Uniaika> merijn: alright
2020-11-16 16:51:48 <merijn> Uniaika: GC time doesn't scale with amount of garbage
2020-11-16 16:51:59 <Uniaika> merijn: oh? my bad :)
2020-11-16 16:52:01 <merijn> Uniaika: GHC's GC scales with "amount of non-garbage"
2020-11-16 16:52:08 <kuribas> but ghc is optimized for lots of garbage.
2020-11-16 16:52:18 <justsomeguy> What does the “temp->data = value;” in the code sample here https://en.wikipedia.org/wiki/Linked_list#Singly_linked_lists mean? Is this like “data.value = temp”, where ``data.value`` is a record data with a field value?
2020-11-16 16:52:20 <tomjaguarpaw> I have large amounts of non-garbage, but perhaps only 1GB
2020-11-16 16:52:23 <kuribas> using mutable data can be even worse.
2020-11-16 16:52:24 <merijn> Uniaika: For exactly this reason, lazy evaluation produces *tons* of garbage :)
2020-11-16 16:52:44 <merijn> tomjaguarpaw: Oh, yes, that can hurt you
2020-11-16 16:52:48 <Uniaika> kuribas: TIL, thanks for correcting me
2020-11-16 16:53:00 <Uniaika> merijn: I'm interested in knowing more about how non-garbage affects GC times
2020-11-16 16:53:02 <merijn> tomjaguarpaw: Is this large amount constant during most of your application?
2020-11-16 16:53:10 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
2020-11-16 16:53:27 <tomjaguarpaw> No, it's the benchmark input data
2020-11-16 16:53:43 <tomjaguarpaw> So I generate something that's about 1 GB, run a function on it, GOTO 10
2020-11-16 16:53:49 × jlamothe quits (~jlamothe@198.251.55.207) (Quit: leaving)
2020-11-16 16:53:52 <merijn> Uniaika: GHC uses a "copy & compact" collector, so when GC is triggered, we allocate a new heap and copy all "live" (i.e. non-garbage) data to the new heap, and then throw away the entire old heap
2020-11-16 16:54:10 <merijn> Uniaika: So if there's only 20 bytes of live data and 20 GB of garbage, you only copy 20 bytes and are done
2020-11-16 16:54:35 <Uniaika> oh my, this is indeed genius when you have lots of garbage

All times are in UTC.