
17 Nov
2012
17 Nov
'12
6:19 p.m.
Being concrete, all you can do is: parseAction :: String -> Either A B parseAction str | "(A " `isPrefixOf` str = Left $ read str | "(B " `isPrefixOf` str = Right $ read str parseAction :: String -> Int parseAction str | "(A " `isPrefixOf` str = run $ (read str :: A) | "(B " `isPrefixOf` str = run $ (read str :: B) As you can't return a polymorphic /a/ when you have typed the cases to A or B. Being less concrete, no doubt you can use existentials, but at this point I'd recommend you re-evaluate what you are trying to do.