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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to