[Haskell-cafe] Clever generic ByteString hack?

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Jul 5 08:39:33 EDT 2006

Hello Duncan,

Wednesday, July 5, 2006, 3:25:53 PM, you wrote:

> People sometimes talk about doing a type class to cover string like
> modules.

class ListLike ce e | ce->e where
  head :: ce -> e

instance ListLike [a] a ....
instance ListLike (Sequence a) a ....
instance ListLike ByteString Char ....
instance ListLike (ArraySlice a) a ....

(ByteString is really array slice specialized for "StorableArray Char")

> What functions are you thinking of btw? We may want to include them in
> the ByteString modules anyway (possibly directly rather than in terms of
> other functions, to take advantage of tricks with the representation).

we anyway need class to allow implementing, say, FilePath module
working with strings of any type

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list