two easy questions

Mike T. Machenry dskippy@ccs.neu.edu
Wed, 19 Feb 2003 22:23:45 -0500


Question 1: Is there an easier, more elegant way to write this code?

output a b c d e = println "Hello, this is " ++ show a ++ " a really hard "
  "to write function that " ++ show b ++ " would be easier to write with "
  "a printf " ++ show c ++ show d ++ show e

Question 2: Is there a way to express the following relationship?
 I want to have a set of symbols with ordering and another set that is
part of that ordering but with a different parent. For exammple,

data Player = Detective | Fugitive deriving (Enum)
data Detective = Red | Green | Blue deriving (Enum)
data Fugitive = MrX deriving (Enum)

I want (succ Blue) == MrX and (pred MrX) == Blue. I could do this by putting
them all in the same enumeration but I want to be able to test that the
symbol is a Detective or Fugitive. By the way, how do I test that it's a
detective? Do I pattern match it?

foo Detective(x) = if x == Purple
                   then ...
                   else ...
-- ?

Thanks for the help.
-mike