[Haskell-cafe] a way to convert partial functions to functions with Maybe's

Ivan Miljenovic ivan.miljenovic at gmail.com
Tue Apr 13 20:32:28 EDT 2010


On 13 April 2010 20:02, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
> func1 :: T -> T
> func1 A = B
>
> func1Fixed :: T -> Maybe T
> func1Fixed A = Just B
> func1Fixed _ = Nothing

Why not use Maybe for func1 in the first place?  Or are you wanting to
automagically make all uses of head, tail, etc. safe?


-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list