Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 694 695 696 697 698 699 700 701 702 703 704 .. 18015
1,801,484 events total
2021-06-29 03:47:06 dunkeln joins (~dunkeln@188.71.193.140)
2021-06-29 03:50:42 × myShoggoth quits (~myShoggot@75.164.51.64) (Ping timeout: 265 seconds)
2021-06-29 03:54:10 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 268 seconds)
2021-06-29 03:55:14 <qrpnxz> it occured to me that you could use a right-associative fold and the list constructor to visit a non-functor like Data.Set and get the results (and effects) back out. Thanks to laziness it would be fully streaming, not actual list generated, and you could feed that stream right back into some kind of fromList constructor, linearly back into the set; then i realized this is probably like a "no-duh, that's w
2021-06-29 03:55:15 <qrpnxz> hat toList and fromList is for" from experienced haskellers hahaha, but still, it was nice to realize that. List are such a super power, they are really streams and nondeterminism. Vectors are for actual linear storage.
2021-06-29 03:57:42 <jophish> "lists are control flow"
2021-06-29 03:58:27 <qrpnxz> most important thing to know about foldr are is that it doesn't mean (from the right). I have to keep beating that into my head
2021-06-29 03:58:39 × cjb quits (~cjb@user/cjb) (Quit: brb)
2021-06-29 03:59:03 <qrpnxz> dunno why i used parens as quotes there sorry about that lol
2021-06-29 04:02:11 cjb joins (~cjb@user/cjb)
2021-06-29 04:02:16 boxscape_ joins (~boxscape_@p4ff0ba7a.dip0.t-ipconnect.de)
2021-06-29 04:02:28 <boxscape_> well, unless you had some fusion rules that would still generate a list, no?
2021-06-29 04:02:30 <boxscape_> lazily, yes
2021-06-29 04:02:44 <boxscape_> but the runtime will allocate memory for the constructors and such
2021-06-29 04:05:15 <boxscape_> ...though being lazy does mean it probably gets away with constant memory for that list
2021-06-29 04:05:27 <qrpnxz> right
2021-06-29 04:07:59 <Axman6> depends on if the foldr/toList definition gets inlined or not - if the consuming function immediately deconstructs the list, then you'd likely get "fusion" from... the case of known constructor optimisation, IIRC
2021-06-29 04:08:31 <boxscape_> hm, I see
2021-06-29 04:09:16 <Axman6> foo [] = 0; foo (x:xs) = x + foo xs; foo (toList someSet is basically going to give you the same result as if you'd done foldr (a b -> a + b) 0 someSet (hopefully)
2021-06-29 04:17:45 × hendursaga quits (~weechat@user/hendursaga) (Remote host closed the connection)
2021-06-29 04:18:13 hendursaga joins (~weechat@user/hendursaga)
2021-06-29 04:18:46 <qrpnxz> just did a little test and compared to a program that builds a big set and then prints it's size, one that that builds a big set, toList, maps, fromList, and then prints it's size, the latter only used 40% more memory. Not double, amazin!
2021-06-29 04:18:53 <qrpnxz> and certainly not triple
2021-06-29 04:18:55 Erutuon joins (~Erutuon@user/erutuon)
2021-06-29 04:19:22 <Axman6> I'm surprised it used more actually
2021-06-29 04:19:59 <qrpnxz> i'm very impressed it didn't use double cause it can't really reasonable reuse the first set can it? That's hella impressive if that's what it is doing
2021-06-29 04:27:38 × ChaiTRex quits (~ChaiTRex@user/chaitrex) (Quit: ChaiTRex)
2021-06-29 04:27:57 ChaiTRex joins (~ChaiTRex@user/chaitrex)
2021-06-29 04:31:18 × dunkeln quits (~dunkeln@188.71.193.140) (Ping timeout: 265 seconds)
2021-06-29 04:31:40 dunkeln joins (~dunkeln@94.129.65.28)
2021-06-29 04:33:14 × nate1 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 265 seconds)
2021-06-29 04:36:02 × Cajun quits (~Cajun@ip98-163-211-112.no.no.cox.net) (Quit: Client closed)
2021-06-29 04:36:13 × AgentM quits (~agentm@pool-162-83-130-212.nycmny.fios.verizon.net) (Quit: Leaving.)
2021-06-29 04:38:33 Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de)
2021-06-29 04:42:12 × shanemikel_ quits (~shanemike@desk.roadwar.net) (Quit: ZNC 1.7.5+deb4 - https://znc.in)
2021-06-29 04:43:03 lavaman joins (~lavaman@98.38.249.169)
2021-06-29 04:43:47 shanemikel joins (~shanemike@desk.roadwar.net)
2021-06-29 04:53:03 <Axman6> one of the many nice things you can do with pure functions - inlining them is always "safe", and when inlined you can see things like case statements being directly applied to known constructors - so code like case (x:xs) of (y:ys) -> ...; [] -> can eb simplified to never allocate that (:)
2021-06-29 04:53:22 <Axman6> that's the main reason I was surprised it even used 40% more memory
2021-06-29 04:55:22 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-06-29 04:56:35 nate1 joins (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net)
2021-06-29 04:58:17 Cajun joins (~Cajun@ip98-163-211-112.no.no.cox.net)
2021-06-29 05:02:38 × juhp quits (~juhp@128.106.188.66) (Quit: juhp)
2021-06-29 05:02:51 juhp joins (~juhp@128.106.188.66)
2021-06-29 05:04:09 × nate1 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 258 seconds)
2021-06-29 05:07:33 × dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 265 seconds)
2021-06-29 05:09:22 × derelict quits (~derelict@user/derelict) (Quit: WeeChat 3.2)
2021-06-29 05:18:03 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-06-29 05:18:08 <Maxdamantus> I imagine the main determiner there would be whether they're statically resolvable, not whether their pure.
2021-06-29 05:18:37 <Maxdamantus> Impure functions can be inlined to achieve the same benefits.
2021-06-29 05:19:01 <Maxdamantus> s/\<their\>/they're/
2021-06-29 05:19:58 warnz joins (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f)
2021-06-29 05:21:52 × slowButPresent quits (~slowButPr@user/slowbutpresent) (Quit: leaving)
2021-06-29 05:22:33 × sayola quits (~vekto@dslb-088-078-152-192.088.078.pools.vodafone-ip.de) (Ping timeout: 258 seconds)
2021-06-29 05:23:22 _ht joins (~quassel@82-169-194-8.biz.kpn.net)
2021-06-29 05:24:02 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-29 05:24:42 <qrpnxz> Axman6, well remember i built a second set with the same number of elements as the first set. If it somehow freed the first set immediately, that's impressive, if it somehow reused that set to build the second, that impressive. If i were to do toList and then do length rather than just measure the size directly, then indeed in that case it uses the exact amount of memory. And it does! I just tested it.
2021-06-29 05:26:52 jneira joins (~jneira@212.8.115.226)
2021-06-29 05:28:11 <Axman6> right - depends on if that initial set even existed at all to begin with too
2021-06-29 05:28:42 fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net)
2021-06-29 05:30:05 × warnz quits (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f) (Ping timeout: 268 seconds)
2021-06-29 05:31:14 × falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 265 seconds)
2021-06-29 05:31:26 v01d4lph4 joins (~v01d4lph4@122.160.65.250)
2021-06-29 05:31:26 × v01d4lph4 quits (~v01d4lph4@122.160.65.250) (Changing host)
2021-06-29 05:31:26 v01d4lph4 joins (~v01d4lph4@user/v01d4lph4)
2021-06-29 05:31:27 <qrpnxz> it surely does since streaming into length allocated the memory. I reckon Data.Set is too opaque to go as far as optimizing Set.fromList [] & toList away without an explicit rewrite rule
2021-06-29 05:32:52 × fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 252 seconds)
2021-06-29 05:33:10 × azeem quits (~azeem@dynamic-adsl-94-34-9-28.clienti.tiscali.it) (Ping timeout: 268 seconds)
2021-06-29 05:36:25 dunkeln joins (~dunkeln@94.129.65.28)
2021-06-29 05:40:01 derelict joins (~derelict@user/derelict)
2021-06-29 05:42:01 <qrpnxz> i sometimes see little pounds signs in stdlib code that idk what it does, like in the nice implementation of foldr with foldMap, it has a place that does (Endo #. f), what's happening here?
2021-06-29 05:42:22 wallymathieu joins (~wallymath@81-234-151-21-no94.tbcn.telia.com)
2021-06-29 05:42:31 <qrpnxz> or like Int# -> Int# what is that?
2021-06-29 05:44:20 × Axman6 quits (~Axman6@user/axman6) (Remote host closed the connection)
2021-06-29 05:44:29 <c_wraith> Those are different things. #. is just a normal operator named #.
2021-06-29 05:44:42 Axman6 joins (~Axman6@user/axman6)
2021-06-29 05:44:50 <c_wraith> Int# is special, though. You need an extension, -XMagicHash, to use it.
2021-06-29 05:45:27 <c_wraith> The symbol doesn't have any intrinsic meaning, but it's part of a convention that internal low-level types have names that end with #
2021-06-29 05:46:07 <c_wraith> In particular, Int# is the low-level type that's actually a binary value.
2021-06-29 05:46:09 <c_wraith> @src Int
2021-06-29 05:46:10 <lambdabot> data Int = I# Int#
2021-06-29 05:46:23 <boxscape_> (btw to be clear once you have -XMagicHash you can also have user-defined names ending in #, so it's not restricted to built-in usages)
2021-06-29 05:47:15 <qrpnxz> ah, what's (Endo #. f) mean then?
2021-06-29 05:47:29 <c_wraith> Whatever #. is defined to mean.
2021-06-29 05:47:42 <c_wraith> ... that's probably the newtype-aware composition operator
2021-06-29 05:47:56 <c_wraith> But really, you should be looking at the imports for that one
2021-06-29 05:48:15 <qrpnxz> good idea let me see
2021-06-29 05:48:50 <c_wraith> It's probably https://hackage.haskell.org/package/profunctors-5.6.2/docs/Data-Profunctor-Unsafe.html#v:-35-.
2021-06-29 05:49:09 <c_wraith> But make sure that profunctors is actually involved
2021-06-29 05:50:25 <qrpnxz> 🤨️
2021-06-29 05:50:29 <qrpnxz> absolutely galaxy brain
2021-06-29 05:50:39 <qrpnxz> everything about coerce seems inscrutable
2021-06-29 05:51:24 <qrpnxz> i've noted fmapdefault and foldmap default are coercions of traverse, kind of mind blowing
2021-06-29 05:52:21 takuan joins (~takuan@178-116-218-225.access.telenet.be)
2021-06-29 05:52:27 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 258 seconds)
2021-06-29 05:52:48 <qrpnxz> ahhhhh (#.) ≡ \_ -> \p -> p `seq` rmap coerce p
2021-06-29 05:53:52 azeem joins (~azeem@dynamic-adsl-94-34-20-185.clienti.tiscali.it)
2021-06-29 05:54:23 × cjb quits (~cjb@user/cjb) (Quit: end of day)
2021-06-29 05:55:54 kenran joins (~kenran@b2b-37-24-119-190.unitymedia.biz)
2021-06-29 05:56:36 × killsushi quits (~killsushi@user/killsushi) (Read error: Connection reset by peer)

All times are in UTC.