Jonathan Cast wrote: > Type case is easy: > > genericShow :: Typeable a => a -> String > genericShow x = fromJust $ do > s <- cast x :: Maybe String > return s > `mplus` do > n <- cast x :: Maybe Int > return (show n) > `mplus` do > return "<unknown>"
This is a nice idiom I didn't know before. Definitely worth page on the wiki or two. Cheers Ben _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe