2021/06/24

2021-06-24 00:00:09 +0200 <dminuoso> Hard to answer a theoretical question. Improving performance usually depends on what you're doing exactly
2021-06-24 00:00:13 +0200 <pavonia> That is performance doesn't matter in my case but I'm curious what would be the fastest lookup type
2021-06-24 00:00:51 +0200 <dminuoso> From what I can gather case-of is constant time and fast if GHC can translate it into a jump table
2021-06-24 00:01:54 +0200 <dminuoso> And then it depends on the scrutinee and the pattern clauses
2021-06-24 00:02:07 +0200 <pavonia> But you can't build such a case-expression dynamically, can you?
2021-06-24 00:02:35 +0200 <dminuoso> From what exactly?
2021-06-24 00:03:11 +0200 <dminuoso> generally, Id probably just use HashMap from unordered-containers as a first step if I want quick access
2021-06-24 00:03:30 +0200 <dminuoso> If that's not enough, then Id look into the specific issue at hand
2021-06-24 00:03:57 +0200 <pavonia> For two lists as in the example above
2021-06-24 00:04:12 +0200 <pavonia> So HashMap is generally faster than Map?
2021-06-24 00:06:53 +0200 <dminuoso> Generally yes
2021-06-24 00:07:12 +0200 <dminuoso> If the key is Int, then IntMap might (?) perform better, Im not sure
2021-06-24 00:07:22 +0200 <dminuoso> Also, Id throw in bytestring-tries into the mix
2021-06-24 00:07:37 +0200 <dminuoso> https://hackage.haskell.org/package/bytestring-trie
2021-06-24 00:07:47 +0200trcc(~trcc@2-104-60-169-cable.dk.customer.tdc.net)
2021-06-24 00:08:10 +0200 <dminuoso> pavonia: but keep in mind that HashMap is unordered
2021-06-24 00:08:36 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 252 seconds)
2021-06-24 00:08:37 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:a50f:dc97:cbbc:9783) (Remote host closed the connection)
2021-06-24 00:09:28 +0200derelict(~derelict@user/derelict) (Ping timeout: 246 seconds)
2021-06-24 00:09:28 +0200 <monochrom> Premature generalization is the root of premature optimization.
2021-06-24 00:10:58 +0200 <monochrom> Ultimately it may come down to just telling you about -ddump-simpl -ddump-stg -ddump-opt-cmm -ddump-asm so you can see what happens to your specific case.
2021-06-24 00:11:30 +0200trcc(~trcc@2-104-60-169-cable.dk.customer.tdc.net) (Client Quit)
2021-06-24 00:11:47 +0200 <monochrom> Because the other correct answer is "it depends".
2021-06-24 00:12:02 +0200fendor(~fendor@178.165.189.179.wireless.dyn.drei.com) (Remote host closed the connection)
2021-06-24 00:15:06 +0200__monty__(~toonn@user/toonn) (Quit: leaving)
2021-06-24 00:15:27 +0200machinedgod(~machinedg@24.105.81.50)
2021-06-24 00:16:01 +0200 <pavonia> dminuoso: Okay, thanks
2021-06-24 00:18:02 +0200killsushi(~killsushi@user/killsushi)
2021-06-24 00:21:54 +0200brian_da_mage(~Neuromanc@user/briandamag) (Ping timeout: 264 seconds)
2021-06-24 00:25:13 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Quit: Lost terminal)
2021-06-24 00:27:40 +0200peterhil(~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) (Ping timeout: 252 seconds)
2021-06-24 00:27:42 +0200peterhil_(~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi)
2021-06-24 00:28:43 +0200vicfred(~vicfred@user/vicfred) (Quit: Leaving)
2021-06-24 00:31:34 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-06-24 00:31:34 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-06-24 00:31:51 +0200lavaman(~lavaman@98.38.249.169) (Remote host closed the connection)
2021-06-24 00:32:00 +0200tzar_bomba(~tzar_bomb@78-56-41-78.static.zebra.lt) (Quit: Client closed)
2021-06-24 00:33:25 +0200azeem(~azeem@dynamic-adsl-84-220-246-231.clienti.tiscali.it) (Ping timeout: 265 seconds)
2021-06-24 00:33:32 +0200vicentius(~vicentius@user/vicentius) (Ping timeout: 252 seconds)
2021-06-24 00:34:13 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-24 00:35:05 +0200 <hseg> are newtype family instances not representationally equal to what they wrap?
2021-06-24 00:35:11 +0200Morrow(~Morrow@bzq-110-168-31-106.red.bezeqint.net)
2021-06-24 00:35:19 +0200ephemient(uid407513@id-407513.tooting.irccloud.com) (Quit: Connection closed for inactivity)
2021-06-24 00:36:00 +0200 <hseg> so given e.g. data family Sorted f; newtype instance Sorted [a] = SortedList {getSorted :: [a]}
2021-06-24 00:36:14 +0200 <hseg> coerce :: Sorted [a] -> [a] is forbidden?
2021-06-24 00:36:47 +0200azeem(~azeem@176.201.6.138)
2021-06-24 00:38:14 +0200 <hseg> hrm... experimenting more shows this isn't what's going wrong, getting more data
2021-06-24 00:42:57 +0200 <hseg> oh ffs. is there a reason the (unordered-)containers haddocks don't show role annotations?
2021-06-24 00:44:22 +0200azeem(~azeem@176.201.6.138) (Read error: Connection reset by peer)
2021-06-24 00:44:42 +0200Ariakenom(~Ariakenom@2001:9b1:efb:fc00:70b4:9739:defc:32cb) (Quit: Leaving)
2021-06-24 00:45:18 +0200azeem(~azeem@dynamic-adsl-94-34-50-190.clienti.tiscali.it)
2021-06-24 00:45:50 +0200jlamothe(~jlamothe@198.251.57.81) (Quit: leaving)
2021-06-24 00:47:32 +0200tromp(~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2021-06-24 00:48:33 +0200jmcarthur(~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net)
2021-06-24 00:50:38 +0200BosonCollider(~olofs@90-227-86-119-no542.tbcn.telia.com) (Ping timeout: 258 seconds)
2021-06-24 00:51:02 +0200derelict(~derelict@user/derelict)
2021-06-24 00:51:46 +0200zeenk(~zeenk@2a02:2f04:a106:9600:82fb:aed9:ca9:38d3) (Quit: Konversation terminated!)
2021-06-24 00:53:01 +0200lavaman(~lavaman@98.38.249.169)
2021-06-24 00:55:39 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:a50f:dc97:cbbc:9783)
2021-06-24 01:00:21 +0200sekun(~sekun@180.190.208.125)
2021-06-24 01:02:08 +0200hseg(~gesh@195.192.229.14) (Quit: WeeChat 3.2)
2021-06-24 01:08:01 +0200pretty_dumm_guy(trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.3-dev)
2021-06-24 01:08:20 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 250 seconds)
2021-06-24 01:13:14 +0200trent2(~trent@2001:8003:340d:d00:b2de:b98:7a93:b0ea)
2021-06-24 01:17:08 +0200hnOsmium0001(uid453710@id-453710.stonehaven.irccloud.com) (Quit: Connection closed for inactivity)
2021-06-24 01:17:19 +0200DNH(~DNH@8.43.122.6) (Quit: Textual IRC Client: www.textualapp.com)
2021-06-24 01:19:49 +0200shiraeeshi(~shiraeesh@109.166.57.36) (Ping timeout: 265 seconds)
2021-06-24 01:21:12 +0200involans(~alex@cpc92718-cmbg20-2-0-cust157.5-4.cable.virginm.net) (Ping timeout: 252 seconds)
2021-06-24 01:26:49 +0200machinedgod(~machinedg@24.105.81.50) (Ping timeout: 246 seconds)
2021-06-24 01:29:32 +0200xsperry(~as@user/xsperry)
2021-06-24 01:29:33 +0200xsperry(~as@user/xsperry) (Excess Flood)
2021-06-24 01:31:33 +0200jmcarthur(~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
2021-06-24 01:34:27 +0200Erutuon(~Erutuon@user/erutuon)
2021-06-24 01:34:47 +0200justsomeguy(~justsomeg@user/justsomeguy)
2021-06-24 01:36:04 +0200waleee(~waleee@h-98-128-228-119.NA.cust.bahnhof.se) (Ping timeout: 250 seconds)
2021-06-24 01:36:43 +0200 <justsomeguy> In lambda calculus, is there a name for something that is the opposite of a combinator? (By "opposite of a combinator" I mean a function that does not use any of its bound arguments, or parameters, but only uses free variables, instead.)
2021-06-24 01:36:47 +0200lavaman(~lavaman@98.38.249.169) (Remote host closed the connection)
2021-06-24 01:37:13 +0200TheRAt(~TheRAt@user/therat) (Read error: Connection reset by peer)
2021-06-24 01:38:17 +0200 <hpc> a constant function?
2021-06-24 01:38:41 +0200 <dolio> That doesn't sound like the opposite of a combinator.
2021-06-24 01:40:07 +0200 <justsomeguy> Do you mean that my description doesn't sound like the opposite of a combinator, or that a constant function doesn't sound like the opposite of a combinator?
2021-06-24 01:41:11 +0200 <monochrom> I propose the name "dependency hell". :)
2021-06-24 01:41:12 +0200 <dolio> The description.
2021-06-24 01:41:42 +0200TheRAt(~TheRAt@user/therat)
2021-06-24 01:42:51 +0200 <dolio> The things usable in the body of a combinator are the parameters, application, and previously defined combinators, in the usual formal definition I'm familiar with.
2021-06-24 01:43:07 +0200 <dolio> So, if it only uses application and previously defined combinators, it's a combinator.
2021-06-24 01:44:38 +0200 <justsomeguy> In functions that aren't combinators, there is also the possibility of using a variable that is defined in an enclosing scope, which is known as a free variable. So, you can use a variable that isn't in the head of a lambda within a function body.
2021-06-24 01:44:40 +0200 <dolio> And in combinator calculi, there aren't any other constants that could go in the body of a combinator.
2021-06-24 01:45:41 +0200 <dminuoso> justsomeguy: So for example the inner lambda in: \x -> \y -> x y ?
2021-06-24 01:46:13 +0200 <dminuoso> Or rather just: \y -> x y
2021-06-24 01:46:17 +0200 <dminuoso> This is simpler to talk about
2021-06-24 01:46:45 +0200 <dminuoso> justsomeguy: Id say its a free expression.
2021-06-24 01:47:12 +0200 <justsomeguy> No, something like (\x -> a x), is an example of what I'm talking about. The x comes from an enclosing scope, and is not a formal parameter in the lambda head of the function, but is still valid in the (untyped) lambda calculus.
2021-06-24 01:47:47 +0200 <dminuoso> justsomeguy: Yeah, Id say the opposite of `combinator` is `free expression`
2021-06-24 01:47:56 +0200 <dminuoso> (where free expression means its some expression with free variables)
2021-06-24 01:48:02 +0200 <justsomeguy> Free expression sounds about right :^)
2021-06-24 01:49:00 +0200Tuplanolla(~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.)
2021-06-24 01:49:19 +0200 <justsomeguy> (There is another name for this thing, though, and I wish I could remember it. Oh well.)
2021-06-24 01:49:26 +0200UpstreamSalmon(uid12077@id-12077.stonehaven.irccloud.com)
2021-06-24 01:50:16 +0200fizbin(~fizbin@c-73-33-197-160.hsd1.nj.comcast.net)
2021-06-24 01:53:21 +0200 <c_wraith> I'm looking at the Applicative laws, and a lot of them seem unusual. Like, Identity, Homomorphism, and Interchange all basically are different forms of "pure is a unit of <*>"
2021-06-24 01:53:43 +0200lavaman(~lavaman@98.38.249.169)
2021-06-24 01:54:14 +0200 <monochrom> Yes, but formally it is very difficult to express that because <*> is annoyingly assymetric.
2021-06-24 01:54:28 +0200 <c_wraith> the only law describing how multiple uses of <*> must interact is the composition law, and it's a really indirect way of essentially saying "<*> is associative"
2021-06-24 01:54:28 +0200fizbin(~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 246 seconds)
2021-06-24 01:54:43 +0200 <monochrom> A version of those laws written in liftA2(,) has a much better chance at looking much nicer.
2021-06-24 01:54:53 +0200 <monochrom> Yes, that too.
2021-06-24 01:56:03 +0200 <c_wraith> I suppose it does all come down to the type asymmetry between the arguments of <*>
2021-06-24 01:57:11 +0200 <shachaf> his paper gives that version too: https://www.staff.city.ac.uk/~ross/papers/Applicative.pdf
2021-06-24 01:57:24 +0200machinedgod(~machinedg@24.105.81.50)
2021-06-24 01:57:49 +0200 <shachaf> T
2021-06-24 01:58:15 +0200 <monochrom> Ah, I should have taught that to my students.
2021-06-24 01:58:50 +0200 <monochrom> I have inflicted the madness of the <*> laws on my students. I feel bad for them.
2021-06-24 01:58:51 +0200 <shachaf> Page 10, I should have said.
2021-06-24 01:59:16 +0200 <shachaf> Certainly symmetric versions are much nicer.
2021-06-24 01:59:34 +0200 <shachaf> Whether liftA2/pure or liftA2 (,)/pure ()
2021-06-24 02:03:34 +0200 <c_wraith> I suppose it is a challenge to just say "if you ignore the type arguments, it's a monoid"
2021-06-24 02:03:39 +0200 <c_wraith> formally, I mean
2021-06-24 02:04:37 +0200myShoggoth(~myShoggot@75.164.29.44) (Ping timeout: 246 seconds)
2021-06-24 02:05:20 +0200myShoggoth(~myShoggot@75.164.29.44)
2021-06-24 02:05:44 +0200 <shachaf> "identity" and "interchange" might instead be called "left identity" and "right identity"
2021-06-24 02:06:09 +0200 <shachaf> And composition is associativity, as you said.
2021-06-24 02:06:11 +0200 <monochrom> They managed to say that. "4. Monoids are phantom Applicative functors" :)
2021-06-24 02:06:17 +0200 <shachaf> So what's going on with homomorphism?
2021-06-24 02:07:58 +0200 <monochrom> Does it help to rewrite as "fmap f (pure x) = pure (f x)"? Now it is a "pure is a natural transformation from Identity to your F" thing...
2021-06-24 02:09:07 +0200 <monochrom> OTOH the form "pure f <*> pure x = pure (f <*>_Identity x)" is a homorphism law.
2021-06-24 02:09:42 +0200 <monochrom> It is a beauty that there are so many perspectives.
2021-06-24 02:16:32 +0200sekun(~sekun@180.190.208.125) (Remote host closed the connection)
2021-06-24 02:16:52 +0200dhil(~dhil@195.213.192.47) (Ping timeout: 268 seconds)
2021-06-24 02:17:06 +0200Unode(~Unode@194.94.44.220) (Quit: Not that cable)
2021-06-24 02:17:17 +0200Unode(~Unode@194.94.44.220)