[Haskell-cafe] a way to convert partial functions to functions with
Maybe's
Ozgur Akgun
ozgurakgun at gmail.com
Tue Apr 13 06:02:06 EDT 2010
Cafe,
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?
Best,
--
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100413/52b12782/attachment.html
More information about the Haskell-Cafe
mailing list