<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1505" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi,</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Just as we can define infix operators as syntactic sugar, 
could we not also have a similar mechanism for programmable fancy 
brackets?</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>There could be a keyword for the bracket declaration and a 
function definition, in this way ana- and catamorphisms, Template Haskell-like 
syntax, and set notation&nbsp;could become a regular feature of the language. I 
am more interested in the general idea than the syntax of this specific 
example:</FONT></DIV>
<DIV><FONT size=2>&nbsp;</FONT></DIV>
<DIV><FONT size=2>\begin{code}</FONT></DIV>
<DIV><FONT size=2>bracket (( _ )) :: a -&gt; Ana a</FONT></DIV>
<DIV><FONT size=2>bracket (| _ |) :: a -&gt;&nbsp;Cata a</FONT></DIV>
<DIV><FONT size=2>bracket [ _ | _&nbsp;|]&nbsp;::&nbsp;Char -&gt; b 
-&gt;&nbsp;Splice --&nbsp;or whatever&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT size=2>bracket {[ _&nbsp;, .. ]} :: [a] -&gt; SList a</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>((( _ ))) :: a -&gt; Ana a</FONT></DIV>
<DIV><FONT size=2>(( x )) = Ana x</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>((| _ |)) :: a -&gt; Cata a</FONT></DIV>
<DIV><FONT size=2>(| x |) = Cata x</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>([ _ | _ |]) :: Char -&gt; b -&gt; Splice</FONT></DIV>
<DIV><FONT size=2>[ c | t |] = case c of</FONT></DIV>
<DIV><FONT 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b 
-&gt; doC t</FONT></DIV>
<DIV><FONT 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d 
-&gt; doD t -- or whatever</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>-- the idea of this bracket is to create a user-defined 
list-type structure</FONT></DIV>
<DIV><FONT size=2>--&nbsp;&nbsp;&nbsp; {[ "the" , "lambda" , "calculus" 
]}</FONT></DIV>
<DIV><FONT size=2>--&nbsp;would have the value</FONT></DIV>
<DIV><FONT size=2>--&nbsp;&nbsp;&nbsp;&nbsp;(SCons "the" (SCons "lambda" (SCons 
"calculus" SEmpty)))</FONT></DIV>
<DIV><FONT size=2>({[ _ , .. ]} :: [a] -&gt; SList a</FONT></DIV>
<DIV><FONT size=2>{[ [] ]}&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;sempty</FONT></DIV>
<DIV><FONT size=2>{[ x:xs ]} = scons x {[ xs ]}</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>\end{code}</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Any thoughts?</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Vivian</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV></BODY></HTML>