<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<blockquote type="cite"
cite="mid:b97dfbc0-9c34-16b1-00b3-30057b527ace@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Hi,<br>
<br>
<blockquote type="cite"
cite="mid:22c3b2b1-04b9-073f-5e57-63902489fa3d@chordify.net">Is
there any standard or guideline for making a "partial" instance
of a class, by which I mean implementing some methods of a
class, but not all of them? In my concrete case I've got some
type X which is almost an Arrow, except that I cannot lift any
function a -> b to my type (of course I can for some a and
b), so I cannot give a sensible implementation for arr. I can
however give sensible implementations for the other methods in
the Arrow class, and I'd like to use them (and possibly derived
combinators) in other places. <br>
</blockquote>
<p>this might not be the general answer you're looking for, but
related to this special case:</p>
<p>Note that arrow syntax (both proc-do-notation and banana
brackets) uses <tt>arr</tt> extensively under the hood. The
same goes for many of the derived combinators. So you can not
simply leave it out. But maybe there's no need to reinvent the
wheel either. What you have probably is something like a <i>profunctor</i>
or a <i>braided category</i>, so you might be in luck finding
some better suited library instead. For the former, probably the
<a moz-do-not-send="true"
href="https://hackage.haskell.org/package/profunctors"><i>profunctors</i></a>
library. For the latter, maybe the <a
href="https://github.com/mikeizbicki/subhask"
moz-do-not-send="true"><i>subhask</i></a> prelude, but more
likely the <a moz-do-not-send="true"
href="https://hackage.haskell.org/package/categories"><i>categories</i></a>
library. If nothing else looking at them might help you better
understand what structure you're dealing with. I personally
don't use subhask, but the hierarchy diagrams and code snippets
alone have been enlightening in the past. They might give you
new search terms on the hunt for a better library.<br>
</p>
</blockquote>
Perfect. In my concrete case I think a profunctor is indeed the
thing I was looking for, and based on the other replies it seems
that in general there are usually other classes that do match the
set of functions you'd like. This of course doesn't completely solve
the problem of the desire to use certain combinators, but I do agree
that using error to partially implement a class isn't satisfactory
either, and is very likely to lead to more problems.<br>
<br>
Jeroen<br>
</body>
</html>