Hi, > Only think I can think of is having the constructors, as seperate data > types, introducing new type classes to group every possible subset of > [X,Y,Z] and [A,B,C,D] and use those type classes when defining the > functions.
Wouldn't it be possible to use Either? You make the constructors seperate data types and then have something like > func1 :: Either X Y -> Either B C When you need more then two alternatives you could define similar datatypes like > OneOfThree x y z = OOTFirst x | OOTSecond y | OOTThird z or something like > {-# LANGUAGE TypeOperators #-} > data Or x y = First x | Second y deriving (Show) > infixl 5 `Or` > func :: Int `Or` String `Or` Integer -> String `Or` Integer but then pattern matching becomes ugly. Christoph
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe