
brian wrote:
On Sat, Aug 9, 2008 at 5:18 PM, Brent Yorgey
wrote: The problem is that BString is not a type, it is a data constructor.
I know.
You could use M.Map BValue BValue, but of course that's probably not what you want either.
Right. That wouldn't be according to spec either.
What's wrong with just using 'String' as the Map key?
It seems wrong. Yeah, it's just a String, but we're being all abstract because that's better practice. It happens that when you parse bencoded data, the length of the string is given. Maybe I want to store that in BString, too.
But mainly I want to know how to think about it differently so that I know what to do when it comes up again and actually matters.
What about using a type parameter: data BValue bString = BString bString | BInteger Integer | BList [BValue bString] | BDictionary (Map bString (BValue bString)) Regards, Maciej