I have a sign function, which can return an error.
signe :: Int -> Char
signe chiffre
| chiffre >= 1 && chiffre <= 9 = '+'
| chiffre == 0 = '0'
| chiffre >= -9 && chiffre <= (-1) = '-'
| otherwise = error "Erreur in the sign"
I'd like to make a simple one to return the corresponding code of the sign, but with error handling.
signes liste = [ signe x | x<-liste ]
I give you an example : For now, if I call
signes [1,3,0,-10]
it gives me
++0*** Exception: Error in sign.
I'd like to have nothing instead of Exception: ++0.