On Feb 6, 2008 9:00 AM, Henning Thielemann
<[EMAIL PROTECTED]> wrote:
> On Wed, 6 Feb 2008, Matthew Pocock wrote:
> > class Buildable b where
> > empty :: b a --makes an empty b with elements of type a
> > insert :: a -> b a -> b a --inserts the new element into the buildable
>
> How can this interface be used both for lists and maps? [...]
One solution is to change the class slightly:
class Buildable t x where
empty :: t
insert :: x -> t -> t
instance Buildable (Map k a) (k, a) where
empty = Map.empty
insert = uncurry Map.insert
--
Denis
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe