<br><br><div class="gmail_quote">On Sun, Jul 29, 2012 at 12:38 PM, Antoine Latter <span dir="ltr"><<a href="mailto:aslatter@gmail.com" target="_blank">aslatter@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Sun, Jul 29, 2012 at 11:37 AM, Antoine Latter <<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>> wrote:<br>
><br>
> The downside to this proposal is that the requester (Edward) actually<br>
> wants a function of type "a -> Maybe Int", so his polymorphic function<br>
> can handle both infinite bit-types and finite bit-types.<br>
><br>
> With the new class, Edward could write:<br>
><br>
> class BitTraversable i where<br>
> traverseBits :: <sometype><br>
><br>
> instance (BitSize i) => BitTraversable i where<br>
> traverseBits = <something><br>
><br>
> instance BitTraversable Integer where<br>
> traverseBits = <something else><br>
><br>
<br>
</div>I should add that this approach looks like it would require<br>
OverlappingInstances.</blockquote><div><br></div><div>Correct. This is not a viable solution for the problem, also it precludes the existance of support for someone else's Natural number type, etc.</div><div><br></div>
<div>Every type that is currently an instance of Bits is either of a fixed size or potentially infinite.</div><div><br></div><div>Changing bitSize to return a Maybe a works. Making a separate BitSize class simply forces me to do exactly what I'm doing right now, which is ignore it and manually probe. </div>
<div><br></div><div>I'm a strong -1 vote to any solution that splits BitSize out into a separate class.</div><div><br></div><div>-Edward</div></div>