Assuming that z :: Int, you can declare an algebraic datatype
data TwoOrThree a b = Three (a, b, Int)
                    | Two (a, b)
   deriving(Show, Eq) -- so you can experiment

And then define expand as

expand :: TwoOrThree a b -> (a, b, Int)
expand (Three tuple) = tuple
expand (Two (a, b)) = (a, b, 1)

Tom (amindfv)

On Oct 2, 2011 6:04 AM, "Du Xi" <sdiyazg@sjtu.edu.cn> wrote: