Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-27 22:24:05 clathomas joins (ad4839b3@pool-173-72-57-179.cmdnnj.fios.verizon.net)
2021-04-27 22:24:29 <clathomas> Hello! I have a quick noob-level efficiency question.
2021-04-27 22:24:49 <clathomas> Why does ` foldl' (+) 0 [1..n] ` not use a constant amount of memory (in ghci) ? Everything I read says that foldl' should evaluate as it goes down the list, so the only space needed should be for the sum. But memory increases (according to `:set +s` in ghci) as n increases.
2021-04-27 22:24:52 × notzmv quits (~zmv@unaffiliated/zmv) (Ping timeout: 252 seconds)
2021-04-27 22:25:06 <lechner> monochrom: it's just a simple SELECT, and can put it in later. my issue is i am completely in over my head rewriting my little website lintian.debian.net in haskell and purescript.
2021-04-27 22:25:11 <monochrom> Note: "after the transaction finishes" ≠ "the last task inside the transaction"
2021-04-27 22:25:38 × letmein quits (~letmein@c-71-59-221-7.hsd1.wa.comcast.net) (Ping timeout: 246 seconds)
2021-04-27 22:26:06 <lechner> i just discovered haskell six months ago, and that math major heart jumped
2021-04-27 22:26:18 <int-e> clathomas: +s reports allocations, not memory residency.
2021-04-27 22:26:50 × Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.)
2021-04-27 22:27:14 <int-e> clathomas: and without optimizations, the list and its elements are allocated... and consumed by foldl' as the sum is computed, so all that stuff becomes garbage immediately.
2021-04-27 22:27:21 <clathomas> int-e: got it, thanks! What is a good way to see "memory residency" ? (Is that the technical term to google for?)
2021-04-27 22:27:42 <int-e> clathomas: with optimizations, ghc will (usually) eliminate the allocations as well
2021-04-27 22:27:43 <monochrom> I run htop to watch memory residency.
2021-04-27 22:28:44 ddellaco_ joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-04-27 22:29:17 × neiluj quits (~jco@unaffiliated/neiluj) (Quit: leaving)
2021-04-27 22:29:22 <int-e> clathomas: I don't know of a convenient way for ghci (monochrom's suggestion may well be the best way). there's +RTS -s which reports "maximum residency" for compiled programs but really doesn't work well for ghci.
2021-04-27 22:29:35 safinaskar joins (~user@109-252-90-136.nat.spd-mgts.ru)
2021-04-27 22:30:02 × ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Remote host closed the connection)
2021-04-27 22:30:04 <monochrom> Sometimes I compile to exe and use "+RTS -s" too, but it only does sampling, not complete monitoring. OK my htop trick gives even fewer samples.
2021-04-27 22:30:26 stree joins (~stree@68.36.8.116)
2021-04-27 22:31:05 ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-04-27 22:31:22 <int-e> Right, we may miss a brief spike in residency with +RTS -s.
2021-04-27 22:31:46 <monochrom> Then again, "+RTS -s" gives its report after normal termination only. For a long-running program I go htop.
2021-04-27 22:32:49 <monochrom> You can use "+RTS -s" on ghci, which measures ghci itself, which is 1% your own code and 99% ghci's own startup cost, which is still something, but you have to quit before you see the report.
2021-04-27 22:33:54 <int-e> for giggles you can try `ghc +RTS -S`
2021-04-27 22:35:14 <clathomas> thanks! Looking into both options. Is there an option for making ghci optimize your files ? `-O2` didn't seem to work (at least with `stack ghci`)
2021-04-27 22:35:32 <monochrom> No.
2021-04-27 22:36:08 <geekosaur> ghci is an interpreter, what good would optimization do?
2021-04-27 22:36:09 <monochrom> Yes but very long story, virtually like no.
2021-04-27 22:36:45 <monochrom> https://downloads.haskell.org/ghc/latest/docs/html/users_guide/ghci.html#loading-compiled-code is the long story.
2021-04-27 22:37:04 <geekosaur> I suppose there is -fobject-code -O2 but then you lose most of the point of ghci
2021-04-27 22:37:26 <clathomas> geekosaur: I am running monte-carlo type simulations based on (fairly simple) combinations of library functions I've written.
2021-04-27 22:38:10 jrm2 joins (~jrm@freebsd/developer/jrm)
2021-04-27 22:38:24 <clathomas> I suppose I want to package up my library so I can optimize and then import ?
2021-04-27 22:38:40 <geekosaur> probably
2021-04-27 22:39:32 <solidus-river> DigitalKiwi: sorry I had to run earlier, thats the book :)
2021-04-27 22:39:37 <monochrom> Oh and the doc there still has this omission. -c is not enough, you need -dynamic too.
2021-04-27 22:42:41 × jrm2 quits (~jrm@freebsd/developer/jrm) (Client Quit)
2021-04-27 22:43:04 jrm2 joins (~jrm@freebsd/developer/jrm)
2021-04-27 22:44:02 × ddellacosta quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Remote host closed the connection)
2021-04-27 22:45:06 ddellaco_ joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-04-27 22:45:49 <monochrom> There was a time my idea of personal library was -i/home/me/my-cool-haskell-files too :)
2021-04-27 22:47:50 safinaskar parts (~user@109-252-90-136.nat.spd-mgts.ru) ()
2021-04-27 22:47:53 safinaskar joins (~user@109-252-90-136.nat.spd-mgts.ru)
2021-04-27 22:48:32 <safinaskar> is there some way to get this datatype transformations automatically: https://paste.debian.net/1195441/ ?
2021-04-27 22:48:37 <clathomas> monochrom: haha indeed. I am changing / debugging the library a lot, so I do think ghci has advantages! But probably I do need to do something more official
2021-04-27 22:49:11 × ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 240 seconds)
2021-04-27 22:51:58 × sdrodge_ quits (~sdrodge@unaffiliated/sdrodge) (Quit: WeeChat 3.1)
2021-04-27 22:52:44 × gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Quit: Leaving)
2021-04-27 22:54:50 jrm2 is now known as jrm
2021-04-27 22:57:21 pbgc joins (~pbgc@a89-152-234-147.cpe.netcabo.pt)
2021-04-27 22:57:22 sdrodge joins (~sdrodge@unaffiliated/sdrodge)
2021-04-27 22:57:31 <monochrom> I may delete "Expr" and "Term" altogether. I have never needed to "remember" user explicit parenthesizing by the time I output an AST.
2021-04-27 22:57:55 × pbgc quits (~pbgc@a89-152-234-147.cpe.netcabo.pt) (Client Quit)
2021-04-27 22:59:15 × hiroaki quits (~hiroaki@2a02:8108:8c40:2bb8:d72c:c07:3040:2376) (Ping timeout: 260 seconds)
2021-04-27 22:59:32 <monochrom> While a parser needs to take input parentheses into account, it can throw away that information very quickly.
2021-04-27 22:59:49 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-04-27 23:01:09 <safinaskar> monochrom: yes. but i am writing my own parser, and it always output full parse tree
2021-04-27 23:02:07 <safinaskar> monochrom: also, i am going to write both parser and printer. and thus i need transformations in both ways between parse tree and ast
2021-04-27 23:02:14 × clathomas quits (ad4839b3@pool-173-72-57-179.cmdnnj.fios.verizon.net) (Quit: Connection closed)
2021-04-27 23:02:40 <monochrom> Then delete AST?
2021-04-27 23:07:38 ep1ctetus_ joins (~epictetus@ip72-194-54-201.sb.sd.cox.net)
2021-04-27 23:08:06 <DigitalKiwi> monochrom: what if your parser is used in an text editor
2021-04-27 23:08:47 DigitalKiwi hands monochrom, monochrom hands a different one back
2021-04-27 23:08:56 geekosaur tempted to point to ghc-exactprint
2021-04-27 23:09:02 <DigitalKiwi> ... + words
2021-04-27 23:09:25 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-04-27 23:10:08 apache8080 joins (~rishi@wsip-70-168-153-252.oc.oc.cox.net)
2021-04-27 23:10:14 × ChrisMarquardt quits (~ChrisMarq@185.204.1.185) (Remote host closed the connection)
2021-04-27 23:10:31 × Tario quits (~Tario@201.192.165.173) (Ping timeout: 252 seconds)
2021-04-27 23:10:41 × epicte7us quits (~epictetus@ip72-194-54-201.sb.sd.cox.net) (Ping timeout: 240 seconds)
2021-04-27 23:11:26 Tario joins (~Tario@200.119.186.99)
2021-04-27 23:11:28 hiroaki joins (~hiroaki@2a02:8108:8c40:2bb8:97a:c563:cb11:fbc)
2021-04-27 23:15:05 ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-04-27 23:15:44 × Chai-T-Rex quits (~ChaiTRex@gateway/tor-sasl/chaitrex) (Remote host closed the connection)
2021-04-27 23:17:07 <safinaskar> monochrom: well, in fact eventually i want to write prover. ast will be typechecked then
2021-04-27 23:19:14 <safinaskar> geekosaur: ghc-exactprint - this was to me?
2021-04-27 23:19:29 × ddellacosta quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 252 seconds)
2021-04-27 23:19:30 <geekosaur> yes
2021-04-27 23:19:48 <geekosaur> it uses information in GHC's AST to regenerate the source that led to the AST
2021-04-27 23:20:06 <geekosaur> although I guess actually it was to monochrom
2021-04-27 23:21:11 letmein joins (~letmein@2601:1c1:4200:938f:f8bf:6a67:4eed:b2c1)
2021-04-27 23:24:07 × sarahzrf_ quits (~sarahzrf_@sarahzrf.com) (Quit: bye)
2021-04-27 23:24:22 sarahzrf joins (~sarahzrf_@sarahzrf.com)
2021-04-27 23:25:04 kiweun joins (~kiweun@2607:fea8:2a62:9600:bc5b:4bb6:fff:c736)
2021-04-27 23:26:20 xPaw1 joins (~xPaw@185.204.1.185)
2021-04-27 23:27:24 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-27 23:28:11 × Guest85960 quits (~alexander@2a02:587:dc0a:2700:39fb:67a3:1f47:16d) (Ping timeout: 260 seconds)
2021-04-27 23:28:31 <monochrom> /nick MrSpeaker
2021-04-27 23:29:08 <monochrom> (refereence to British-style parliaments)
2021-04-27 23:30:16 × kiweun quits (~kiweun@2607:fea8:2a62:9600:bc5b:4bb6:fff:c736) (Ping timeout: 276 seconds)
2021-04-27 23:32:08 <monochrom> Data.Data is what I have heard for auto-coding of catamorphisms, but I have never learned it.
2021-04-27 23:32:31 <monochrom> and the DeriveData extension.
2021-04-27 23:33:11 × Tario quits (~Tario@200.119.186.99) (Ping timeout: 240 seconds)
2021-04-27 23:33:21 <monochrom> The conversions between Expr+Term and AST look like catamorphisms respectively.
2021-04-27 23:36:56 × Synthetica quits (uid199651@gateway/web/irccloud.com/x-jzozwncadkywrjny) (Quit: Connection closed for inactivity)
2021-04-27 23:37:21 <safinaskar> geekosaur: ghc-exactprint parses and prints haskell. i am writing parser for any cfg-based language
2021-04-27 23:40:43 conal joins (~conal@64.71.133.70)
2021-04-27 23:45:23 × conal quits (~conal@64.71.133.70) (Client Quit)

All times are in UTC.