Segno

segno x = if x < 0 then -1 else if x == 0 then 0 else 1

oppure

segno x = if x < 0 then -1 
                   else if x == 0 then 0 
                                  else 1

oppure

segno x
    | x < 0     = -1 
    | x == 0    = 0
    | otherwise = 1


Valore assoluto


assoluto x = if x < 0 then -x else x

assoluto x = if x < 0 then -x
                      else x
assoluto x
    | x < 0     = -x
    | otherwise = x