Explain typeclass instance resolution

Anthony Clayden <[email protected]> Thu, 6 Dec 2018 23:38:16 +1300
Newsgroups gmane.comp.lang.haskell.hugs.user
Message-ID <CAM7nRYQTB=qYWUN4fwwgem2Jp+HMwTH+Riyh6guokYrGmHtuZw@mail.gmail.com>
--===============5393904446967227310==
Content-Type: multipart/alternative; boundary="0000000000005a414c057c5819cd"

--0000000000005a414c057c5819cd
Content-Type: text/plain; charset="UTF-8"

He he, while I was poking about in the type inference code ...

There's an experimental command `:xplain` instance resolution.

The code to implement it needs switching on with a preprocessor flag set in
options.h.in then ./configure and recompile Hugs.

Use it by giving a constraint to be explained:

Hugs> :x Show (Maybe [Int])

(It seems a bit temperamental, fair enough for a hidden feature: if it
can't resolve an instance, it'll say so, but also give some misleading
messages with fragments of code leftover from previous uses.)


AntC

--0000000000005a414c057c5819cd
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">He he, while I was poking about in the type inference cod=
e ...</div><div dir=3D"auto"><br></div><div dir=3D"auto">There&#39;s an exp=
erimental command `:xplain` instance resolution.</div><div dir=3D"auto"><br=
></div><div dir=3D"auto">The code to implement it needs switching on with a=
 preprocessor flag set in <a href=3D"http://options.h.in">options.h.in</a> =
then ./configure and recompile Hugs.</div><div dir=3D"auto"><br></div><div =
dir=3D"auto">Use it by giving a constraint to be explained:</div><div dir=
=3D"auto"><br></div><div dir=3D"auto">Hugs&gt; :x Show (Maybe [Int])</div><=
div dir=3D"auto"><br></div><div dir=3D"auto">(It seems a bit temperamental,=
 fair enough for a hidden feature: if it can&#39;t resolve an instance, it&=
#39;ll say so, but also give some misleading messages with fragments of cod=
e leftover from previous uses.)</div><div dir=3D"auto"><br></div><div dir=
=3D"auto"><br></div><div dir=3D"auto">AntC</div>

--0000000000005a414c057c5819cd--

--===============5393904446967227310==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSHVncy1Vc2Vy
cyBtYWlsaW5nIGxpc3QKSHVncy1Vc2Vyc0BoYXNrZWxsLm9yZwpodHRwOi8vbWFpbC5oYXNrZWxs
Lm9yZy9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vaHVncy11c2Vycwo=

--===============5393904446967227310==--