<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
From the Haskell 2010 report: "An <span class="ptmri7t-">instance
declaration </span>introduces an instance of a class. Let <span
class="pcrr7t-">class</span><span class="cmmi-10"> cx</span><span
class="cmmi-10"> </span><span class="pcrr7t-">=></span><span
class="cmmi-10"> C</span><span class="cmmi-10"> u</span><span
class="cmmi-10"> </span><span class="pcrr7t-">where</span><span
class="cmmi-10"> </span><span class="pcrr7t-">{</span><span
class="cmmi-10"> cbody</span><span class="cmmi-10"> </span><span
class="pcrr7t-">}</span> be a <span class="pcrr7t-">class</span>
declaration. The general form of the corresponding instance
declaration is: <span class="pcrr7t-">instance</span><span
class="cmmi-10"> cx</span><span class="cmsy-10">′</span><span
class="cmmi-10"> </span><span class="pcrr7t-">=></span><span
class="cmmi-10"> C</span><span class="cmmi-10"> </span><span
class="cmr-10">(</span><span class="cmmi-10">T</span><span
class="cmmi-10"> u</span><sub><span class="cmr-7">1</span></sub><span
class="cmmi-10"> </span><span class="cmmi-10">…</span><span
class="cmmi-10"> u</span><sub><span class="cmmi-7">k</span></sub><span
class="cmr-10">)</span><span class="cmmi-10"> </span><span
class="pcrr7t-">where</span><span class="cmmi-10"> </span><span
class="pcrr7t-">{</span><span class="cmmi-10"> d</span><span
class="cmmi-10"> </span><span class="pcrr7t-">}</span> where <span
class="cmmi-10">k </span><span class="cmsy-10">≥ </span><span
class="cmr-10">0</span>."<br>
<br>
Note that your instance declaration has a form C (T u1) u2.<br>
<br>
I think adding the FlexibleInstances extension, as suggested by the
compiler, will work. Although, depending on the context, you might
need UndecidableInstances too.<br>
<br>
The core problem is that the FFT class must have been defined with
the MultiParamTypeClasses extension, which usually leads to
nastiness like this.<br>
<br>
<div class="moz-cite-prefix">On 11/10/2015 11:15 AM, David Banas
wrote:<br>
</div>
<blockquote
cite="mid:495D63F3-8252-409E-AC77-5C9C380FCCE3@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Hi all,
<div><br>
</div>
<div>I don’t understand why this code:</div>
<div><br>
</div>
<div>50: instance (IsNat n, RealFloat a) => FFT (RTree n) a
where</div>
<div><br>
</div>
<div>is generating this error:</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">fft_test.hs:50:36:</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">
Illegal instance declaration for ‘FFT (RTree n) a’</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">
(All instance types must be of the form (T a1 ... an)</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">
where a1 ... an are *distinct type variables*,</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">
and each type variable appears at most once in the
instance head.</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">
Use FlexibleInstances if you want to disable this.)</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;">
In the instance declaration for ‘FFT (RTree n) a’</div>
</div>
<div><br>
</div>
<div>and was hoping someone could help me get it.</div>
<div><br>
</div>
<div>Thanks!</div>
<div>-db</div>
<div><br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Haskell-Cafe mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
</pre>
</blockquote>
<br>
</body>
</html>