
Jeff Heard wrote:
It is parametrically polymorphic in a. And no, it's an arbitrary decision, BUT... it allows me and other users to define generally useful behaviours and widgets to package with the library using the basic types without locking down 'a'. The EventData type looks like this:
data Event a { ..., edata :: EData a, ... }
data EData a = EChar Char | EString String | EStringL [String] | EByteString ByteString | EByteStringL [ByteString] | EInt Int | EIntL [Int] | EDouble Double | EDoubleL [Double] | EBool Bool | EBoolL [Bool] | EOther a | EOtherL [a]
Maybe I wasn't clear, and probably I'm being dense. I understand what you've done - I looked at the type declarations before commenting - but I don't understand why. Why is it useful to be able to use basic types without locking down 'a'? Why is it useful to have a value of type "Event FooBar" which, in apparent defiance of the FooBar parameter, actually contains a value of type Double? Jules