[Haskell-cafe] a way to convert partial functions to functions with
ozgurakgun at gmail.com
Tue Apr 13 06:02:06 EDT 2010
Is there a way (without going into the IO lands) to achieve this:
data T = A | B | C
func1 :: T -> T
func1 A = B
func1Fixed :: T -> Maybe T
func1Fixed A = Just B
func1Fixed _ = Nothing
I want a function to generate func1Fixed, given func1.
I guess this is doable with exception handling (catching the error from
func1)? Is it the only way?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe