[Haskell-cafe] Re: The Proliferation of List-Like Types

John Goerzen jgoerzen at complete.org
Wed Feb 20 11:23:16 EST 2008

On 2008-02-20, Ross Paterson <ross at soi.city.ac.uk> wrote:
>> conventions won't be usable in my ByteString code, for instance.
>> [...]
>>   http://software.complete.org/listlike/static/doc/ListLike/Data-ListLike.html
> As Henning pointed out, multiple parameter type classes are problematic
> for core libraries at present.
> An alternative might be explicit dictionaries.  For example, a partial
> solution would be to provide coinductive views, i.e. for all these types
> to provide functions of a type like
> 	full -> Maybe (item, full)

Hrm, what exactly is the return data here?  Is is the head and the
tail if the list has >= 1 item, or Nothing otherwise?  Or...?

The problem with this approach, if my guess is correct, is that you
can't achieve native speed because you will have to be re-implementing
everything in terms of these functions.  For instance, I'd be using a
re-implementation of length instead of a native ByteString length,
which may be much faster.

I notice that Data.Foldable does some similar things but does not use
multi-parameter type classes.  I seem to recall that I attempted to do
this in the same manner, but got tripped up somewhere.  I can't
remember now exactly what the problem was, but I can go back and look
if nobody knows off-hand.

What is the problem with MPTC in base?

More information about the Haskell-Cafe mailing list