Hmmm, using generics seems like massive overkill for option handling. Could you
describe what you are exactly trying to achieve?
I am doing command line options parsing. I've defined Flag type with constructor
for each possible option:
data Flag = Verbose |
Input String |
Output String |
Filter String
deriving (Show, Typeable, Data)getOpt returns me a list of such objects. Now I need to look things up there by constructor. For example:
....
doSomething fltflag
where
(Filter fltflag) = findFlag (Filter "none") optsTo achieve this I've defined:
instance Eq Flag where
x == y = toConstr x == toConstr yfindFlag :: Flag -> [Flag] -> Flag findFlag f fs = fromMaybe f (find (==f) fs)
Sincerely, Vadim
-- "La perfection est atteinte non quand il ne reste rien a ajouter, mais quand il ne reste rien a enlever." (Antoine de Saint-Exupery)
smime.p7s
Description: S/MIME cryptographic signature_______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
