Replies inline.<span></span><br><br>On Sunday, December 13, 2015, martin <<a href="mailto:martin.drautzburg@web.de">martin.drautzburg@web.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 12/13/2015 um 11:57 PM schrieb Patrick Redmond:<br>
> I think you're off to a good start with this insert signature:<br>
><br>
> insert :: a -> C a -> Maybe (C a)<br>
> "Insert element `a` into structure `C a` and return a new structure if the insertion was successful."<br>
<br>
This way I'd have to be explicit about what C really is, don't I? Data.Set certainly has a very explicit data structure<br>
under the hood. I was hoping to express the idea of "something that can be inserted to and removed from" without<br>
specifying how the data is actually stored.</blockquote><div><br></div><div>Use a typeclass. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">But maybe that's a bad point to start from. At least this is where the trouble started when I tried to implement<br>
something on top of it. I just didn't have enough "flesh" to work with.</blockquote><div><br></div><div>Yes, you will have to write a concrete implementation anyway, so start with that. Make an explicit data structure, with concretely typed functions to manipulate it.</div><div><br></div><div>When you have two of these explicit implementations, make a typeclass and provide two instances - one which delegates to each of the implementations.</div>