[Haskell-cafe] self-referential data
Brent Yorgey
byorgey at seas.upenn.edu
Sat Aug 9 18:18:04 EDT 2008
On Sat, Aug 09, 2008 at 05:09:06PM -0500, brian wrote:
> >From https://secure.wikimedia.org/wikipedia/en/wiki/Bencoding , I
> think I should code
>
> data BValue = BString String
> | BInteger Integer
> | BList [BValue]
> | BDictionary (M.Map BString BValue)
>
> but: Not in scope: type constructor or class `BString'
>
> The implementations I've found just implemented BDictionary's map key
> as String, but I think that's kind of wrong.
The problem is that BString is not a type, it is a data constructor.
You could use M.Map BValue BValue, but of course that's probably not
what you want either. What's wrong with just using 'String' as the
Map key?
-Brent
More information about the Haskell-Cafe
mailing list