[Haskell-cafe] Typeclass for functions taking different kinds of strings

Taru Karttunen taruti at taruti.net
Wed Aug 5 07:24:35 EDT 2009


It seems like a very common issue to have an API like:

foo   :: String -> Foo
fooBS :: ByteString -> Foo
fooLBS:: L.ByteString -> Foo

is there currently a library that makes unifying them easy?

Below is attached one try at this, does it make sense? I'm thinking of
uploading it to Hackage but would like comments first.

With the library the above code is transformed into:

foo :: StringLike string => string -> Foo

- Taru Karttunen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StringLike.hs
Type: application/octet-stream
Size: 2260 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090805/67858356/StringLike.obj

More information about the Haskell-Cafe mailing list