<div>Iavor: Wow, I really like the >--c--> trick at the type level.</div><div><br></div><div>Note: we can shorten that somewhat and improve the fixity to associate correctly, matching the associativity of (->), which fortunately associates to the right. (associating to the left can be done with a similar trick, based on the original version of this hack by Chung-Chieh Shan.)</div>
<div><br></div><div>
<font face="courier new, monospace">{-# LANGUAGE TypeOperators, PolyKinds #-}</font></div><div><font face="courier new, monospace">import Control.Category</font></div><div><font face="courier new, monospace"><br></font></div>
<div><font face="courier new, monospace">infixr 0 >~</font></div><div><font face="courier new, monospace">infixr 0 ~></font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">type (>~) a b = b a</font></div>
<div><font face="courier new, monospace">type (~>) a b = a b</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">g :: Category c => (x >~c~> y) -> (y >~c~> z) -> x >~c~> z</font></div>
<div><font face="courier new, monospace">g = undefined</font></div><div><br></div><div>Note, this also has the benefit of picking the correct associativity for >~c~>. Unlike naively using a locally bound (~>) and avoids the headaches of picking (-->) and (--->) or something equally hideous when working with two categories.</div>
<div><br></div><div><div><font face="courier new, monospace">class (Category c, Category d) => CFunctor f c d | f c -> d, f d -> c where</font></div><div><font face="courier new, monospace"> cmap :: (a >~c~> b) -> f a >~d~> f b</font></div>
</div><div><br></div>
<div>-Edward</div><div><br></div><div class="gmail_quote">On Mon, Sep 17, 2012 at 1:02 PM, Sjoerd Visscher <span dir="ltr"><<a href="mailto:sjoerd@w3future.com" target="_blank">sjoerd@w3future.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>Note that nobody was suggesting two pragmas with incompatible behaviors, only to have just one symbol reserved to still be able to have type operator variables.<div>
<br></div><div>I do like your suggestion, although >--c--> is quite a bit longer than ~>.</div><span><font color="#888888"><div><br></div><div>Sjoerd</div></font></span><div><br><div><div><div>
<div>On Sep 17, 2012, at 6:28 PM, Iavor Diatchki wrote:</div><br></div></div><blockquote type="cite"><div><div>Hello,<br><br><div class="gmail_quote">I think that it would be a mistake to have two pragmas with incompatible behaviors: for example, we would not be able to write modules that use Conal's libraries and, say, the type nats I've been working on.</div>
<div class="gmail_quote">If the main issue is the notation for arrows, has anoyone played with what can be done with the current (7.6) system? I just thought of two variations that seem to provide a decent notation for writing arrow-ish programs. The second one, in particular, mirrors the arrow notation at the value level, so perhaps that would be enough?</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">-Iavor</div><div class="gmail_quote"><br></div><div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><div class="gmail_quote">
<font face="courier new, monospace">{-# LANGUAGE TypeOperators, KindSignatures #-}</font></div><div class="gmail_quote"><font face="courier new, monospace">module Test where</font></div><div class="gmail_quote"><font face="courier new, monospace"><br>
</font></div><div class="gmail_quote"><font face="courier new, monospace">import Control.Category </font></div><div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace">-- Variant 1: Post-fix annotation</font></div>
<div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace">type (a ---> b) c = c a b</font></div><div class="gmail_quote"><font face="courier new, monospace"><br>
</font></div><div class="gmail_quote"><font face="courier new, monospace">f :: Category c => (x ---> y) c -> (y ---> z) c -> (x ---> z) c</font></div><div class="gmail_quote"><font face="courier new, monospace">f = undefined</font></div>
<div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace">-- Variant 2: Arrow notation</font></div>
<div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace">type a >-- (c :: * -> * -> *) = c a</font></div><div class="gmail_quote">
<font face="courier new, monospace">type c --> b = c b</font></div><div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace">infix 2 >--</font></div>
<div class="gmail_quote"><font face="courier new, monospace">infix 1 --></font></div><div class="gmail_quote"><font face="courier new, monospace"><br></font></div><div class="gmail_quote"><font face="courier new, monospace">g :: Category c => (x >--c--> y) -> (y >--c--> z) -> (x >--c--> z)</font></div>
<div class="gmail_quote"><font face="courier new, monospace">g = undefined</font></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div></div></div></div><div>
_______________________________________________<br>Glasgow-haskell-users mailing list<br><a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">Glasgow-haskell-users@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
</div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
<br></blockquote></div><br>