<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:windowtext;}
h3
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:14.5pt;
        font-family:Arial;
        color:#005A9C;
        font-weight:bold;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:Verdana;
        color:windowtext;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
code
        {font-family:"Courier New";}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        border:none;
        padding:0cm;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 31.35pt 72.0pt 31.3pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:2128504368;
        mso-list-template-ids:-198002956;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>

</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
Where is there documentation for rebindable syntax for monads with class</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
constraints:</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
(&gt;&gt;=) :: (Foo m, Baz a) =&gt; m a -&gt; (a -&gt; m b) -&gt; m b</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
http://article.gmane.org/gmane.comp.lang.haskell.cvs.ghc/9447/match=syntax</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
The users guide seems to disallow such type signatures:</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'>|
http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#rebindable-syntax</span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 color=black face=Verdana><span
style='font-size:10.0pt;color:black'>I don&#8217;t think it&#8217;s in 6.4.&nbsp;&nbsp; Here&#8217;s
the documentation from the HEAD. <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 color=black face=Verdana><span
style='font-size:10.0pt;color:black'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 color=black face=Verdana><span
style='font-size:10.0pt;color:black'>Simon<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 color=black face=Verdana><span
style='font-size:10.0pt;color:black'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 color=black face=Verdana><span
style='font-size:10.0pt;color:black'><o:p>&nbsp;</o:p></span></font></p>

<h3 style='background:white'><a name=rebindable-syntax></a><b><font size=4
color="#005a9c" face=Arial><span lang=EN style='font-size:14.5pt'>7.3.5.&nbsp;Rebindable
syntax<o:p></o:p></span></font></b></h3>

<p style='background:white'><font size=3 color=black face=Arial><span lang=EN
style='font-size:12.0pt;font-family:Arial'>GHC allows most kinds of built-in
syntax to be rebound by the user, to facilitate replacing the </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>Prelude</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> with a home-grown version,
for example.<o:p></o:p></span></font></p>

<p style='background:white'><font size=3 color=black face=Arial><span lang=EN
style='font-size:12.0pt;font-family:Arial'>You may want to define your own
numeric class hierarchy. It completely defeats that purpose if the literal
&quot;1&quot; means &quot;</span></font><code><font size=2 face="Courier New"><span
lang=EN style='font-size:10.0pt'>Prelude.fromInteger 1</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>&quot;, which is what the
Haskell Report specifies. So the </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>-fno-implicit-prelude</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> flag causes the following
pieces of built-in syntax to refer to <em><i><font face=Arial><span
style='font-family:Arial'>whatever is in scope</span></font></i></em>, not the
Prelude versions: <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>An integer literal </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>368</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> means &quot;</span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>fromInteger
(368::Integer)</span></font></code><font face=Arial><span lang=EN
style='font-family:Arial'>&quot;, rather than &quot;</span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>Prelude.fromInteger
(368::Integer)</span></font></code><font face=Arial><span lang=EN
style='font-family:Arial'>&quot;. <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>Fractional literals are handed in just the same way,
except that the translation is </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>fromRational
(3.68::Rational)</span></font></code><font face=Arial><span lang=EN
style='font-family:Arial'>. <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>The equality test in an overloaded numeric pattern
uses whatever </span></font><code><font size=2 face="Courier New"><span
lang=EN style='font-size:10.0pt'>(==)</span></font></code><font face=Arial><span
lang=EN style='font-family:Arial'> is in scope. <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>The subtraction operation, and the
greater-than-or-equal test, in </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>n+k</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> patterns use whatever </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>(-)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> and </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>(&gt;=)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> are in scope. <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>Negation (e.g. &quot;</span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>- (f x)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>&quot;) means &quot;</span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>negate (f x)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>&quot;, both in numeric
patterns, and expressions. <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>&quot;Do&quot; notation is translated using whatever
functions </span></font><code><font size=2 face="Courier New"><span lang=EN
style='font-size:10.0pt'>(&gt;&gt;=)</span></font></code><font face=Arial><span
lang=EN style='font-family:Arial'>, </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>(&gt;&gt;)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>, and </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>fail</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>, are in scope (not the
Prelude versions). List comprehensions, mdo (<a
href="file:///\\Cam-01-unx\simonpj\builds\HEAD-1\ghc\docs\users_guide\users_guide\syntax-extns.html#mdo-notation"
title="7.3.3.&nbsp;The recursive do-notation&#10;">Section&nbsp;7.3.3,
&#8220;The recursive do-notation &#8221;</a>), and parallel array
comprehensions, are unaffected. <o:p></o:p></span></font></p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1;
background:white'><![if !supportLists]><font size=2 color=black face=Symbol><span
lang=EN style='font-size:10.0pt;font-family:Symbol'><span style='mso-list:Ignore'>&middot;<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></span></font><![endif]><font face=Arial><span lang=EN
style='font-family:Arial'>Arrow notation (see <a
href="file:///\\Cam-01-unx\simonpj\builds\HEAD-1\ghc\docs\users_guide\users_guide\arrow-notation.html"
title="7.7.&nbsp;Arrow notation&#10;">Section&nbsp;7.7, &#8220;Arrow notation
&#8221;</a>) uses whatever </span></font><code><font size=2 face="Courier New"><span
lang=EN style='font-size:10.0pt'>arr</span></font></code><font face=Arial><span
lang=EN style='font-family:Arial'>, </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>(&gt;&gt;&gt;)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>, </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>first</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>, </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>app</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'>, </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>(|||)</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> and </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>loop</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> functions are in scope. But
unlike the other constructs, the types of these functions must match the Prelude
types very closely. Details are in flux; if you want to use this, ask! <o:p></o:p></span></font></p>

<p style='background:white'><font size=3 color=black face=Arial><span lang=EN
style='font-size:12.0pt;font-family:Arial'>In all cases (apart from arrow
notation), the static semantics should be that of the desugared form, even if
that is a little unexpected. For emample, the static semantics of the literal </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>368</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> is exactly that of </span></font><code><font
size=2 face="Courier New"><span lang=EN style='font-size:10.0pt'>fromInteger
(368::Integer)</span></font></code><font face=Arial><span lang=EN
style='font-family:Arial'>; it's fine for </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>fromInteger</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> to have any of the types: <o:p></o:p></span></font></p>

<div style='mso-element:para-border-div;border:solid windowtext 1.0pt;
padding:4.0pt 4.0pt 4.0pt 4.0pt;background:white'><pre><font size=2
color=maroon face="Courier New"><span lang=EN style='font-size:10.0pt;
color:maroon'>fromInteger :: Integer -&gt; Integer<o:p></o:p></span></font></pre><pre><font
size=2 color=maroon face="Courier New"><span lang=EN style='font-size:10.0pt;
color:maroon'>fromInteger :: forall a. Foo a =&gt; Integer -&gt; a<o:p></o:p></span></font></pre><pre><font
size=2 color=maroon face="Courier New"><span lang=EN style='font-size:10.0pt;
color:maroon'>fromInteger :: Num a =&gt; a -&gt; Integer<o:p></o:p></span></font></pre><pre><font
size=2 color=maroon face="Courier New"><span lang=EN style='font-size:10.0pt;
color:maroon'>fromInteger :: Integer -&gt; Bool -&gt; Bool<o:p></o:p></span></font></pre></div>

<p style='background:white'><font size=3 color=black face=Arial><span lang=EN
style='font-size:12.0pt;font-family:Arial'>Be warned: this is an experimental
facility, with fewer checks than usual. Use </span></font><code><font size=2
face="Courier New"><span lang=EN style='font-size:10.0pt'>-dcore-lint</span></font></code><font
face=Arial><span lang=EN style='font-family:Arial'> to typecheck the desugared
program. If Core Lint is happy you should be all right.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face=Verdana><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>