Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,505 events total
2021-08-26 10:29:21 <dminuoso> If you want to investigate the first, which is just humor by the way, just remember that Costate is just an old name for Store.
2021-08-26 10:29:41 <dminuoso> So consider something like C, where accessing a structs field is done by say `f.g`
2021-08-26 10:29:50 <dminuoso> But we cannot pass around this `.g` as a first class value
2021-08-26 10:30:19 <dminuoso> So the "path into some nested value(s)" is not a first class value in many languages
2021-08-26 10:30:34 <dminuoso> The closest analogy to lens I found, is something like XPath or CSS selectors.
2021-08-26 10:31:07 <dminuoso> But using that only makes sense if the reader is already familiar with say XPath
2021-08-26 10:32:04 <dminuoso> Oh and here's another item to the list above, which I think is actually valuable in some sense:
2021-08-26 10:32:33 <dminuoso> - lenses split an object into the focus, and the whole with a hole where the focus belonged.
2021-08-26 10:32:44 <dminuoso> But that one is generally not useful for teaching lenses
2021-08-26 10:32:58 <dminuoso> They are rather an intuition about how VL-style lenses work internally
2021-08-26 10:35:55 hannessteffenhag joins (~hannesste@ip4d14ffc8.dynamic.kabel-deutschland.de)
2021-08-26 10:36:12 × desophos_ quits (~desophos@c-24-14-63-128.hsd1.il.comcast.net) (Quit: Leaving)
2021-08-26 10:37:10 × azeem quits (~azeem@dynamic-adsl-78-13-242-140.clienti.tiscali.it) (Ping timeout: 240 seconds)
2021-08-26 10:37:38 shailangsa joins (~shailangs@host86-185-102-120.range86-185.btcentralplus.com)
2021-08-26 10:37:39 azeem joins (~azeem@176.201.15.223)
2021-08-26 10:38:23 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:c68:9e4d:912c:4792)
2021-08-26 10:41:13 cheater joins (~Username@user/cheater)
2021-08-26 10:42:39 xff0x joins (~xff0x@2001:1a81:53a5:7900:5864:fdd9:e9b9:647)
2021-08-26 10:42:40 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:c68:9e4d:912c:4792) (Ping timeout: 240 seconds)
2021-08-26 10:50:40 × tengu1 quits (~tengu1@cpe-70-121-244-14.neb.res.rr.com) (Quit: Client closed)
2021-08-26 10:50:54 cfricke joins (~cfricke@user/cfricke)
2021-08-26 10:56:22 × MoC quits (~moc@user/moc) (Quit: Konversation terminated!)
2021-08-26 10:56:27 × azeem quits (~azeem@176.201.15.223) (Read error: Connection reset by peer)
2021-08-26 10:57:06 azeem joins (~azeem@dynamic-adsl-78-13-253-103.clienti.tiscali.it)
2021-08-26 11:01:01 alx741 joins (~alx741@186.178.109.43)
2021-08-26 11:01:12 × jpds quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 276 seconds)
2021-08-26 11:01:23 <kuribas> Gurkenglas: I find the definition in the Optics packages quite good: "An optic is a first-class, composable notion of substructure."
2021-08-26 11:02:01 <kuribas> Gurkenglas: IMO to explain it, start eays, from a getter/setter for a field.
2021-08-26 11:02:14 <Gurkenglas> eays?
2021-08-26 11:02:18 <kuribas> easy :)
2021-08-26 11:02:21 jpds joins (~jpds@gateway/tor-sasl/jpds)
2021-08-26 11:03:19 <maerwald> not sure that's gonna help a newbie :p
2021-08-26 11:03:20 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-08-26 11:03:25 lavaman joins (~lavaman@98.38.249.169)
2021-08-26 11:03:49 <kuribas> If you understand what a lens is for a field, then you can generalise it to traversals, and prisms.
2021-08-26 11:04:37 <kuribas> A lens over a field is quite easy to understand. It's nothing more than a getter and setter.
2021-08-26 11:05:09 <Gurkenglas> dminuoso, the third - has its place; it's the problem for which optics are the solution, whereas the "small action into big action" is the gear I would give the user to have any hope of understanding/debugging/coming up with lens lines
2021-08-26 11:07:52 × lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 252 seconds)
2021-08-26 11:10:08 <Gurkenglas> dminuoso, the fourth -, "Lens' s a: s <-> (a,_); Traversal' s a: s <-> ([a],_); Prism' s a: s <-> Either a _; ..." is an implementation lens could have had, but doesn't remotely! Although I suppose the connection is a neat one and maybe (,) and Either should be defined that way in the first place :)
2021-08-26 11:14:13 × zaquest quits (~notzaques@5.128.210.178) (Remote host closed the connection)
2021-08-26 11:15:54 zaquest joins (~notzaques@5.128.210.178)
2021-08-26 11:17:24 <Gurkenglas> kuribas, @optics: nice! The reason that they use % instead of . is that Haskell doesn't yet allow control of error messages for . like it does for newtypes, and the impredicative types embarassment, yes?
2021-08-26 11:17:44 [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470)
2021-08-26 11:18:00 × cfricke quits (~cfricke@user/cfricke) (Ping timeout: 250 seconds)
2021-08-26 11:18:11 × jonathanx_ quits (~jonathan@dyn-8-sc.cdg.chalmers.se) (Remote host closed the connection)
2021-08-26 11:22:25 <Gurkenglas> "Since Optic is a newtype, other libraries that wish to define optics must depend upon its definition." <- ...do we not have some way of saying "and here's a definition that can only be used if you also import the optics package."?
2021-08-26 11:25:04 neo1 joins (~neo3@cpe-292712.ip.primehome.com)
2021-08-26 11:25:25 <Gurkenglas> I suppose in the end the library can define s->a and s->b->t... or even, to be more on the nose, (((s->a) -> (s->b->t)) -> x) -> x :)
2021-08-26 11:25:28 <kuribas> Gurkenglas: (.) only operates on functions, but an optic isn't a function.
2021-08-26 11:25:45 <kuribas> Gurkenglas: or more general on Categories, but it isn't a Category either.
2021-08-26 11:26:05 sszark joins (~sszark@h-155-4-128-59.NA.cust.bahnhof.se)
2021-08-26 11:26:15 jonathanx joins (~jonathan@dyn-8-sc.cdg.chalmers.se)
2021-08-26 11:26:27 <Gurkenglas> kuribas, yeah "reason they don't use ." is to be read as "reason they don't define optics as functions"
2021-08-26 11:26:58 <kuribas> Gurkenglas: IMO "." is confusing and leaking abstractions.
2021-08-26 11:27:17 <kuribas> because it is used the wrong way than what you would expect.
2021-08-26 11:27:21 × jtomas quits (~jtomas@233.red-83-34-2.dynamicip.rima-tde.net) (Remote host closed the connection)
2021-08-26 11:27:39 jtomas joins (~jtomas@233.red-83-34-2.dynamicip.rima-tde.net)
2021-08-26 11:27:42 Neuromancer joins (~Neuromanc@user/neuromancer)
2021-08-26 11:28:19 <Gurkenglas> kuribas, I argue that the user should think of the other direction as the expected one! What implementation of what optic does not involve function composition?
2021-08-26 11:29:23 <kuribas> Gurkenglas: I mean, it's leaking the abstraction, because the user shouldn't not think about the implementation.
2021-08-26 11:30:02 <Gurkenglas> If every implementation is the same then I disagree.
2021-08-26 11:31:05 <Gurkenglas> Hmm, except not every implementation is the same, as in Ctrl-F "fourth -".
2021-08-26 11:31:31 <kuribas> There are already different means to implement optics.
2021-08-26 11:31:40 cfricke joins (~cfricke@user/cfricke)
2021-08-26 11:31:51 <Gurkenglas> Do errors from the optics package ever leak the abstraction?
2021-08-26 11:31:58 <kuribas> No
2021-08-26 11:34:06 <Gurkenglas> Here's an argument for making actions the newtypes instead of optics: It makes it so that instead of hardcoding in the subset relation as a class, we hardcode in the element relation as a class.
2021-08-26 11:35:55 pretty_dumm_guy joins (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655)
2021-08-26 11:36:10 <Gurkenglas> Then the kind that pops out when you compose needn't be hardcoded, instead you intersect the hardcoded sets.
2021-08-26 11:36:18 dude joins (~da1dude@112.201.99.74)
2021-08-26 11:38:08 lortabac_ joins (~lortabac@151.73.13.59)
2021-08-26 11:38:08 × lortabac quits (~lortabac@62.98.11.57) (Read error: Connection reset by peer)
2021-08-26 11:39:21 × dadude quits (~da1dude@112.201.99.74) (Ping timeout: 250 seconds)
2021-08-26 11:42:22 dadude joins (~da1dude@112.201.99.74)
2021-08-26 11:45:37 × dude quits (~da1dude@112.201.99.74) (Ping timeout: 248 seconds)
2021-08-26 11:47:34 × banacorn quits (~banacorn@2001-b011-0003-1131-c802-b4b6-b5ea-5124.dynamic-ip6.hinet.net) (Quit: Client closed)
2021-08-26 11:50:47 × drd quits (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) (Ping timeout: 240 seconds)
2021-08-26 11:56:18 × mc47 quits (~mc47@xmonad/TheMC47) (Quit: Leaving)
2021-08-26 11:58:14 mc47 joins (~mc47@xmonad/TheMC47)
2021-08-26 12:00:56 machinedgod joins (~machinedg@135-23-192-217.cpe.pppoe.ca)
2021-08-26 12:00:58 burnsidesLlama joins (~burnsides@dhcp168-011.wadham.ox.ac.uk)
2021-08-26 12:01:02 × sjb0 quits (~stephen@1.145.57.172) (Quit: Leaving.)
2021-08-26 12:01:47 burnside_ joins (~burnsides@dhcp168-011.wadham.ox.ac.uk)
2021-08-26 12:01:47 × burnsidesLlama quits (~burnsides@dhcp168-011.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-08-26 12:05:52 <kuribas> Gurkenglas: just compare the type if "view :: Control.Monad.Reader.Class.MonadReader s m => (a -> Const a a) -> s -> Const a s" vs "view :: view :: Is k A_Getter => Optic' k is s a -> s -> a"
2021-08-26 12:06:11 <kuribas> Gurkenglas: This MonadReader and Const stuff should not be relevant if you just want to *use* lenses.
2021-08-26 12:06:42 <kuribas> Gurkenglas: However, it *is* relevant to know that view works with any Optic that is a A_Getter.
2021-08-26 12:07:13 <kuribas> Gurkenglas: which means a subtyping relationship implemented using a typeclass.
2021-08-26 12:09:17 gehmehgeh joins (~user@user/gehmehgeh)
2021-08-26 12:09:35 <kuribas> Gurkenglas: in other words, the interface of Optic contains the necessary information about how to use it, but not more than needed.
2021-08-26 12:10:35 <Gurkenglas> I agree that Const and MonadReader shouldn't be exposed. My suggestion is to turn "(%) :: JoinKinds k l m => Optic k s u -> Optic l u a -> Optic m s a" into "(.) :: Action k, Action l, Action m => (l u -> m s) -> (k a -> l u) -> (k a -> m s)".
2021-08-26 12:11:21 <Gurkenglas> Although I suppose Action needn't even be a class there
2021-08-26 12:11:30 <Gurkenglas> so in the end (.) is just fully general, uhhh how do I even say this
2021-08-26 12:14:03 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-08-26 12:14:44 <Gurkenglas> My suggestion is to turn "Optic A_Lens s a" into "Action m A_Lens => m a -> m s".
2021-08-26 12:15:19 <Gurkenglas> (Could say "Action m Lens" there even, I think?)
2021-08-26 12:15:45 <Gurkenglas> (probably not, if Lens is a type alias.)
2021-08-26 12:16:11 × azeem quits (~azeem@dynamic-adsl-78-13-253-103.clienti.tiscali.it) (Ping timeout: 250 seconds)
2021-08-26 12:16:42 azeem joins (~azeem@dynamic-adsl-78-13-253-103.clienti.tiscali.it)
2021-08-26 12:17:18 <kuribas> Gurkenglas: you are free to design your own lens abstraction, but it is not trivial...

All times are in UTC.