
2008/2/19 Wolfgang Jeltsch
Attached is just a quickly hacked Boolean module. Nothing very special. I'd be happy if you could prettify this (choose better names, add documentation, etc.). Thanks for any effort.
Thanks to you for the module. I have a few questions though. Why are the value-level reflecting functionsimplemented as type-class methods? It makes the code more verbose and I don't see any advantage compared to simply defining a function per class. Let me show you an example: This is your implementation of Not: class (Boolean boolean, Boolean boolean') => Not boolean boolean' | boolean -> boolean', boolean' -> boolean where not :: boolean -> boolean' instance Not False True where not _ = true instance Not True False where not _ = false This is how I would do it: class (Boolean boolean, Boolean boolean') => Not boolean boolean' | boolean -> boolean', boolean' -> boolean where instance Not False True instance Not True False not :: Not a b => a -> b not = undefined Furthermore, why did you choose to use Boolean instead of simply Bool? Cheers, Fons