fork download
  1. import Data.Tuple.OneTuple
  2.  
  3. class Tupleify a b | a -> b where
  4. tupleify :: a -> b
  5.  
  6. data Test a b c = Test1 a | Test2 b c | Test3 String Int deriving (Eq, Show)
  7.  
  8. instance Tupleify (Test a b c) (OneTuple a) where
  9. tupleify (Test1 x) = OneTuple x
  10.  
  11. instance Tupleify (Test a b c) (b, c) where
  12. tupleify (Test2 x y) = (x, y)
  13. tupleify (Test3 x y) = (x, y)
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty