Logs: liberachat/#haskell
| 2021-06-09 07:16:24 | × | MQ-17J quits (~MQ-17J@8.21.10.116) (Ping timeout: 244 seconds) |
| 2021-06-09 07:16:41 | → | MQ-17J joins (~MQ-17J@8.21.10.116) |
| 2021-06-09 07:17:10 | × | slowButPresent quits (~slowButPr@user/slowbutpresent) (Quit: leaving) |
| 2021-06-09 07:17:44 | <siers> | can I use lens (in combo with th) to access the "a" which is inside all cases of a disjoint union? Simplest example "Either a a" |
| 2021-06-09 07:18:45 | <dminuoso> | siers: use `failing` |
| 2021-06-09 07:19:17 | <dminuoso> | Together with unsafeSingular you can even reconstruct a lens from this. |
| 2021-06-09 07:19:17 | → | kenran joins (~kenran@200116b82b683c006ea54bdc3ffd5a0f.dip.versatel-1u1.de) |
| 2021-06-09 07:19:32 | → | dhouthoo joins (~dhouthoo@178-117-36-167.access.telenet.be) |
| 2021-06-09 07:20:31 | <dminuoso> | % f :: Lens' (Either (Int, Char) (String, Int)) Int; f = unsafeSingular (_Left . _1 `failing` _Right . _2) -- siers |
| 2021-06-09 07:20:31 | <yahb> | dminuoso: |
| 2021-06-09 07:21:00 | → | ddellacosta joins (~ddellacos@89.46.62.109) |
| 2021-06-09 07:21:30 | → | ramon joins (~ramon@user/ramon) |
| 2021-06-09 07:21:41 | <siers> | nice |
| 2021-06-09 07:23:20 | <siers> | I think unsafeSingular could be mentioned here then: https://stackoverflow.com/questions/36521208/how-to-make-the-product-of-two-lenses |
| 2021-06-09 07:23:22 | <dminuoso> | (I guess you can even use `singular` here) |
| 2021-06-09 07:23:32 | × | agumonke` quits (~user@88.163.231.79) (Ping timeout: 250 seconds) |
| 2021-06-09 07:24:12 | <siers> | never mind, probably not |
| 2021-06-09 07:24:25 | <dminuoso> | % f :: Lens' (Either (Int, Char) (String, Int)) Int; f = singular (_Left . _1 `failing` _Right . _2) |
| 2021-06-09 07:24:25 | <yahb> | dminuoso: |
| 2021-06-09 07:24:47 | → | teaSlurper joins (~chris@81.96.113.213) |
| 2021-06-09 07:24:56 | <dminuoso> | % Left (1, 'f') & f .~ 10 |
| 2021-06-09 07:24:56 | <yahb> | dminuoso: Left (10,'f') |
| 2021-06-09 07:25:04 | <dminuoso> | % Right ("foo", 20) & f .~ 10 |
| 2021-06-09 07:25:04 | <yahb> | dminuoso: Right ("foo",10) |
| 2021-06-09 07:25:07 | <siers> | nice |
| 2021-06-09 07:25:30 | × | ddellacosta quits (~ddellacos@89.46.62.109) (Ping timeout: 252 seconds) |
| 2021-06-09 07:26:03 | <dminuoso> | Yeah, I make heavy use of this trick, as ugly as it is. |
| 2021-06-09 07:26:53 | <siers> | why do you think it's ugly? :) |
| 2021-06-09 07:27:15 | <siers> | because requires human proof? |
| 2021-06-09 07:27:18 | <siers> | it* |
| 2021-06-09 07:29:46 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-09 07:30:09 | <dminuoso> | siers: It's rather, in the type algebra, it's very obvious and visible that this shouldnt even need proof. |
| 2021-06-09 07:31:00 | × | teaSlurper quits (~chris@81.96.113.213) (Ping timeout: 252 seconds) |
| 2021-06-09 07:31:35 | <dminuoso> | siers: Its the same thing with the article you mentioned |
| 2021-06-09 07:31:52 | Erutuon_ | is now known as Erutuon |
| 2021-06-09 07:33:34 | <dminuoso> | Often I get away with just Folds instead, but if you stare at this, it makes you crave for a more fitting abstraction |
| 2021-06-09 07:33:35 | <dminuoso> | https://gist.github.com/dminuoso/d73bf2520faf4e36d3168c8db789727a |
| 2021-06-09 07:33:44 | → | nschoe joins (~quassel@178.251.84.79) |
| 2021-06-09 07:33:50 | <siers> | you mean shouldn't need proof or should be possible to encode as a proof? |
| 2021-06-09 07:34:46 | × | asm quits (~alexander@burner.asm89.io) (Changing host) |
| 2021-06-09 07:34:46 | → | asm joins (~alexander@user/asm) |
| 2021-06-09 07:36:05 | <dminuoso> | siers: In my problem domain, at least with the representation I chose, sum types are sort of like diamonds. I constantly split them up (with say filteredBy), or I want to join them back together (with summing/unsafeSingular+failingT) |
| 2021-06-09 07:37:05 | <dminuoso> | But there's no way to track "these prism-like things are disjoint" for example in the lens/optics ergonomics |
| 2021-06-09 07:37:14 | <dminuoso> | You need manual human written proof |
| 2021-06-09 07:37:17 | <dminuoso> | Every time. |
| 2021-06-09 07:37:26 | <dminuoso> | Or you just shrug and pretend its alright |
| 2021-06-09 07:38:00 | <siers> | right, but it's due to a language limitation? or could you technically encode that and carry it along in haskell? |
| 2021-06-09 07:38:39 | → | ubert joins (~Thunderbi@p200300ecdf259da7d446db1a2ac53d1c.dip0.t-ipconnect.de) |
| 2021-06-09 07:38:40 | <dminuoso> | No idea, really. I just know this act of "splitting/joining sum types" doesnt fit well into lens/optics. |
| 2021-06-09 07:39:02 | <siers> | gotcha |
| 2021-06-09 07:40:21 | × | tzh quits (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) (Quit: zzz) |
| 2021-06-09 07:41:07 | × | yd502 quits (~yd502@180.168.212.6) (Ping timeout: 264 seconds) |
| 2021-06-09 07:42:16 | → | yd502 joins (~yd502@180.168.212.6) |
| 2021-06-09 07:44:19 | <dminuoso> | The primitive I originally wanted, was some: partition :: (Is k An_AffineFold, Is l An_AffineFold) => Optic' k is a i -> Optic' l is a j -> IxAffineFold (Either i j) a a -- or some such. |
| 2021-06-09 07:45:23 | <dminuoso> | But even this representation completely throws away the information, since you're back to square one with the index of (Either i j) |
| 2021-06-09 07:46:22 | × | trent quits (~trent@2001:8003:340d:d00:b2de:b98:7a93:b0ea) (Ping timeout: 244 seconds) |
| 2021-06-09 07:46:25 | lode | is now known as Aardwolf |
| 2021-06-09 07:46:43 | ← | Aardwolf parts (~lode@77-56-208-202.dclient.hispeed.ch) (Leaving) |
| 2021-06-09 07:47:42 | <dminuoso> | And of course its unsafe already, since it demands proof that the provided affine folds are disjoint |
| 2021-06-09 07:49:27 | × | ukari quits (~ukari@user/ukari) (Remote host closed the connection) |
| 2021-06-09 07:50:48 | × | hnOsmium0001 quits (uid453710@id-453710.stonehaven.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-06-09 07:55:02 | → | ukari joins (~ukari@user/ukari) |
| 2021-06-09 07:56:21 | → | mastarija joins (~mastarija@31.217.11.88) |
| 2021-06-09 07:56:23 | × | Chobbes quits (~Chobbes@user/chobbes) (Ping timeout: 252 seconds) |
| 2021-06-09 07:56:41 | → | zeenk joins (~zeenk@2a02:2f04:a310:b600:b098:bf18:df4d:4c41) |
| 2021-06-09 07:56:46 | → | yd502_ joins (~yd502@180.168.212.6) |
| 2021-06-09 07:57:03 | <mastarija> | Can't remember, how does one "install" a package globally so I can use it from ghci without having to create a project? |
| 2021-06-09 07:57:16 | <mastarija> | I thought it was cabal install --lib random |
| 2021-06-09 07:57:25 | → | peterhil joins (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) |
| 2021-06-09 07:57:34 | <Cajun> | last i recall it was `cabal install --lib PACKAGE` |
| 2021-06-09 07:57:50 | → | cfricke joins (~cfricke@user/cfricke) |
| 2021-06-09 07:58:01 | <mastarija> | Yes, that's what I tried, but ghci still can not find System.Random for some reason |
| 2021-06-09 07:59:04 | × | yd502 quits (~yd502@180.168.212.6) (Ping timeout: 250 seconds) |
| 2021-06-09 07:59:10 | <mastarija> | Oh, I tried for a second time and now I get some error |
| 2021-06-09 07:59:17 | <lortabac> | mastarija: you need to make the package visible in ghci |
| 2021-06-09 07:59:22 | → | yd502 joins (~yd502@180.168.212.6) |
| 2021-06-09 07:59:28 | <mastarija> | Yes, in that one file |
| 2021-06-09 07:59:33 | <mastarija> | I'm gonna check now |
| 2021-06-09 08:00:03 | <lortabac> | you can also do it interactively: :set -package PACKAGE_NAME |
| 2021-06-09 08:00:31 | <merijn> | mastarija: --lib is *at best* in beta atm |
| 2021-06-09 08:00:49 | <mastarija> | That's ok, I just wanted to try something out quickly |
| 2021-06-09 08:01:03 | → | Chobbes joins (~Chobbes@user/chobbes) |
| 2021-06-09 08:01:21 | <merijn> | mastarija: you can start ghci with a package in scope via "cabal repl --build-depends" |
| 2021-06-09 08:01:41 | <merijn> | i.e. "cabal repl --build-depends random-x.y.z" |
| 2021-06-09 08:01:52 | × | yd502_ quits (~yd502@180.168.212.6) (Ping timeout: 244 seconds) |
| 2021-06-09 08:02:31 | <lortabac> | yes, merijn's suggestion is more reliable than mine |
| 2021-06-09 08:02:44 | <dminuoso> | +1 to merijn's suggestion |
| 2021-06-09 08:02:50 | <merijn> | Also less likely to make your life a pain later :p |
| 2021-06-09 08:03:25 | <merijn> | "install --lib" is, effectively, the same as pinning all future build plans/installs to the package version you happen to install right now |
| 2021-06-09 08:03:37 | <merijn> | Which, uh, is rather limiting |
| 2021-06-09 08:05:29 | × | yd502 quits (~yd502@180.168.212.6) (Ping timeout: 244 seconds) |
| 2021-06-09 08:05:32 | <mastarija> | meh.. I just erase that pinning file every so often |
| 2021-06-09 08:05:52 | <mastarija> | but yes, --build-depends work nicely |
| 2021-06-09 08:05:57 | <mastarija> | Although it's a bit slow to load |
| 2021-06-09 08:06:06 | <mastarija> | thanks merijn |
| 2021-06-09 08:07:29 | × | phanf quits (~phanf@226.148.192.35.bc.googleusercontent.com) (Quit: leaving) |
| 2021-06-09 08:07:42 | → | hendursa1 joins (~weechat@user/hendursaga) |
| 2021-06-09 08:09:40 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:b95b:27c0:9816:d7ad) (Remote host closed the connection) |
| 2021-06-09 08:10:52 | → | yd502 joins (~yd502@180.168.212.6) |
| 2021-06-09 08:10:58 | × | hendursaga quits (~weechat@user/hendursaga) (Ping timeout: 252 seconds) |
All times are in UTC.