>>>>> "Johan" == Johan Grönqvist <[EMAIL PROTECTED]> writes:
Johan> I am a haskell-beginner and I wish to write a Forth-like Johan> interpreter. (Only for practice, no usefulness.) Johan> I would like use a list (as stack) that can contain several Johan> kinds of values. Johan> data Element = Int Int | Float Float | Func : Machine -> Johan> Machine | ... Johan> Now I would like to have this type be an instance of the class Johan> Show, so that I can see what the stack contains in ghci. Johan> "deriving Show" is impossible as Func is not instance of Johan> Show. Can I make it instance of Show? I just want to define Johan> something like Johan> show (Func _) = "Function, cannot show" err, why not just write instance Show Element where ... show (Func _) = "Function, cannot show" E.g: data Foo = Bar | Foo (Int -> Int -> Int) instance Show Foo where show Bar = "Bar" show (Foo _) = "Func!" main = do putStrLn $ show Bar putStrLn $ show $ Foo (+) -- WBR, Max Vasin. NP: Nothing playing right now _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe