Logs: freenode/#haskell
| 2020-10-16 03:39:28 | → | da39a3ee5e6b4b0d joins (~textual@n11211935170.netvigator.com) |
| 2020-10-16 03:39:34 | <larou> | or maybe even GADTs used this way |
| 2020-10-16 03:39:38 | → | jokester joins (~mono@unaffiliated/jokester) |
| 2020-10-16 03:39:51 | × | Amras quits (~Amras@unaffiliated/amras0000) (Ping timeout: 272 seconds) |
| 2020-10-16 03:39:58 | <larou> | im struggling to write "cons" though |
| 2020-10-16 03:40:56 | <larou> | i think this should work even if it is positioned somewhere other than with the cycle immediately behind it |
| 2020-10-16 03:41:15 | <larou> | so i cant just cast it to a list, cons to the list and cast back |
| 2020-10-16 03:41:21 | <larou> | which would be slow anyway... |
| 2020-10-16 03:41:53 | <larou> | but i cant understand how to link it back together, if it has to somehow itterate over the backwards portion until the cycle |
| 2020-10-16 03:42:31 | <larou> | aswell as the regular iterations over the forwards part, that would basically be the inlined version (cf. fusion) of the to/from list |
| 2020-10-16 03:42:36 | × | jedws quits (~jedws@121.209.161.98) (Quit: Textual IRC Client: www.textualapp.com) |
| 2020-10-16 03:42:58 | → | monochrom joins (trebla@216.138.220.146) |
| 2020-10-16 03:42:58 | <larou> | where these recursions are supposed to reestablish the links to the updated nodes successively |
| 2020-10-16 03:45:12 | → | TheScoop joins (~TheScoop@unaffiliated/tryte) |
| 2020-10-16 03:47:13 | <hololeap> | the exponential law `x^(m+n) = (x^m)(x^n)` translates into haskell types as `Either m n -> x` ~ `(m -> x, n -> x)` |
| 2020-10-16 03:47:19 | <hololeap> | is this basically correct? |
| 2020-10-16 03:49:01 | <dolio> | hololeap: Yes. |
| 2020-10-16 03:49:14 | <int-e> | :t either |
| 2020-10-16 03:49:15 | <lambdabot> | (a -> c) -> (b -> c) -> Either a b -> c |
| 2020-10-16 03:49:37 | <int-e> | :t uncurry either |
| 2020-10-16 03:49:38 | <lambdabot> | (a -> c, b -> c) -> Either a b -> c |
| 2020-10-16 03:49:47 | <int-e> | (one half of the isomorphism) |
| 2020-10-16 03:49:56 | <int-e> | (ignoring bottoms, of course) |
| 2020-10-16 03:50:28 | <hololeap> | int-e: good example :) but what is the other half? |
| 2020-10-16 03:50:40 | <int-e> | :t (. Left) &&& (. Right) |
| 2020-10-16 03:50:42 | <lambdabot> | (Either a b -> c) -> (a -> c, b -> c) |
| 2020-10-16 03:50:58 | hackage | pandoc 2.11.0.2 - Conversion between markup formats https://hackage.haskell.org/package/pandoc-2.11.0.2 (JohnMacFarlane) |
| 2020-10-16 03:51:27 | <larou> | :t (&&&) |
| 2020-10-16 03:51:27 | <hololeap> | right, fanout |
| 2020-10-16 03:51:29 | <lambdabot> | Arrow a => a b c -> a b c' -> a b (c, c') |
| 2020-10-16 03:51:51 | <larou> | % :t (&&&) @(->) |
| 2020-10-16 03:51:51 | <yahb> | larou: (b -> c) -> (b -> c') -> b -> (c, c') |
| 2020-10-16 03:52:31 | <larou> | :t either |
| 2020-10-16 03:52:32 | <lambdabot> | (a -> c) -> (b -> c) -> Either a b -> c |
| 2020-10-16 03:53:00 | <larou> | % :t bimap @Either |
| 2020-10-16 03:53:01 | <yahb> | larou: (a -> b) -> (c -> d) -> Either a c -> Either b d |
| 2020-10-16 03:53:29 | <larou> | is there a way to cast those (->) to `Arrow a' ? |
| 2020-10-16 03:53:52 | <larou> | like something like (&&&) but for Either instead of (,) ? |
| 2020-10-16 03:54:08 | <larou> | (i guess it should work for arbitrary bifunctors) |
| 2020-10-16 03:54:23 | <hololeap> | ah, but `(. Left) &&& (. Right)` means you have to have a value available for both types `a` and `b`, right? |
| 2020-10-16 03:54:23 | <int-e> | :t (|||) |
| 2020-10-16 03:54:24 | <lambdabot> | ArrowChoice a => a b d -> a c d -> a (Either b c) d |
| 2020-10-16 03:54:56 | <hololeap> | doesn't that contradict the semantics of Either? |
| 2020-10-16 03:55:29 | <larou> | that maps from Either to d |
| 2020-10-16 03:56:02 | <int-e> | larou: it's the arrow equiovalent of `either` |
| 2020-10-16 03:56:17 | <larou> | % :t (|||) @Either |
| 2020-10-16 03:56:17 | <yahb> | larou: ; <interactive>:1:1: error: No instance for (ArrowChoice Either) arising from a use of `|||' |
| 2020-10-16 03:56:21 | <larou> | rrg |
| 2020-10-16 03:56:25 | → | nineonin_ joins (~nineonine@216-19-190-182.dyn.novuscom.net) |
| 2020-10-16 03:56:44 | <int-e> | ?! |
| 2020-10-16 03:56:44 | <lambdabot> | Maybe you meant: v @ ? . |
| 2020-10-16 03:56:47 | <larou> | % :t (|||) @(->) |
| 2020-10-16 03:56:47 | <yahb> | larou: (b -> d) -> (c -> d) -> Either b c -> d |
| 2020-10-16 03:56:51 | <larou> | :t either |
| 2020-10-16 03:56:52 | <lambdabot> | (a -> c) -> (b -> c) -> Either a b -> c |
| 2020-10-16 03:56:56 | <larou> | oh! |
| 2020-10-16 03:57:07 | <larou> | i was thinking of bimap still, sry |
| 2020-10-16 03:57:29 | → | Ahmuck1 joins (~Ahmuck@195.206.169.184) |
| 2020-10-16 03:57:42 | <larou> | ah right, that c is like `c^(a+b)` |
| 2020-10-16 03:57:52 | × | ddellacosta quits (~dd@86.106.121.168) (Ping timeout: 246 seconds) |
| 2020-10-16 03:58:05 | × | acarrico quits (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) (Ping timeout: 240 seconds) |
| 2020-10-16 03:58:15 | <hololeap> | sorry, i was mixing up my variables in the two definitions. i forgot that an Arrow is usually the variable `a` |
| 2020-10-16 03:58:30 | <int-e> | :t (arr Left >>>) &&& (arr Right >>>) |
| 2020-10-16 03:58:32 | <lambdabot> | Arrow cat => cat (Either a b) c -> (cat a c, cat b c) |
| 2020-10-16 03:58:50 | <hololeap> | :t arr Left |
| 2020-10-16 03:58:52 | <lambdabot> | Arrow a1 => a1 a2 (Either a2 b) |
| 2020-10-16 03:59:14 | <hololeap> | :i ArrowChoice |
| 2020-10-16 03:59:16 | <int-e> | So yes, both of these generalize to arrows. |
| 2020-10-16 03:59:23 | <larou> | bimap would be `(c+d)^(a+b)` |
| 2020-10-16 03:59:25 | <hololeap> | % :i ArrowChoice |
| 2020-10-16 03:59:25 | <yahb> | hololeap: type ArrowChoice :: (* -> * -> *) -> Constraint; class Arrow a => ArrowChoice a where; left :: a b c -> a (Either b d) (Either c d); right :: a b c -> a (Either d b) (Either d c); (+++) :: a b c -> a b' c' -> a (Either b b') (Either c c'); (|||) :: a b d -> a c d -> a (Either b c) d; {-# MINIMAL (left | (+++)) #-}; -- Defined in `Control.Arrow'; instance [safe] Comonad w => ArrowChoice (Cokle |
| 2020-10-16 03:59:51 | × | nineonine quits (~nineonine@50.216.62.2) (Ping timeout: 260 seconds) |
| 2020-10-16 04:00:01 | × | alexelcu quits (~alexelcu@142.93.180.198) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2020-10-16 04:00:03 | × | polyphem quits (~p0lyph3m@2a02:810d:640:776c:76d7:55f6:f85b:c889) (Ping timeout: 244 seconds) |
| 2020-10-16 04:00:32 | <larou> | ah, so (+++) is like bimap |
| 2020-10-16 04:00:44 | <int-e> | no |
| 2020-10-16 04:00:52 | → | alexelcu joins (~alexelcu@142.93.180.198) |
| 2020-10-16 04:00:55 | <int-e> | err wait, sorry. |
| 2020-10-16 04:00:59 | <hololeap> | oh, int-e already mentioned (|||) |
| 2020-10-16 04:01:00 | <int-e> | yes, but specifically for Either. |
| 2020-10-16 04:01:17 | <larou> | right |
| 2020-10-16 04:01:38 | <int-e> | hololeap: yes, and I was careful to wrote "arrow" in lower case because it's an extra class. |
| 2020-10-16 04:02:25 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2020-10-16 04:02:29 | <larou> | is the idea that arrows by pair kind of subsume list |
| 2020-10-16 04:03:25 | <larou> | thinking of how conal was implementing stacks for his "compilers to categories" |
| 2020-10-16 04:03:38 | <larou> | compiling* |
| 2020-10-16 04:03:40 | → | XorSwap joins (~user@wnpgmb016qw-ds01-98-128.dynamic.bellmts.net) |
| 2020-10-16 04:03:44 | <hololeap> | arrows by pair subsume list? |
| 2020-10-16 04:03:47 | <hololeap> | what does that mean? |
| 2020-10-16 04:04:11 | <larou> | something about matching on cons being like a pair lens thing |
| 2020-10-16 04:04:14 | → | Rudd0 joins (~Rudd0@185.189.115.108) |
| 2020-10-16 04:04:34 | <larou> | like, the arrows way would just be to have nested pairs instead of lists |
| 2020-10-16 04:04:43 | → | mirrorbird joins (~psutcliff@m83-187-163-53.cust.tele2.se) |
| 2020-10-16 04:04:54 | <larou> | and then to lens over any element by distributing over pair |
| 2020-10-16 04:05:00 | × | kupi quits (uid212005@gateway/web/irccloud.com/x-xztwkgxiilqycepj) (Quit: Connection closed for inactivity) |
| 2020-10-16 04:05:14 | <hololeap> | can you give a small example? |
| 2020-10-16 04:05:26 | <larou> | i cant actually lens speak |
| 2020-10-16 04:05:27 | × | whiteline quits (~whiteline@unaffiliated/whiteline) (Ping timeout: 260 seconds) |
| 2020-10-16 04:05:43 | <larou> | or arrow speak for that matter |
| 2020-10-16 04:05:51 | <larou> | so no! sorry... |
All times are in UTC.