@anonymous/

InternationalKnobbyBass

Haskell

No description

fork
loading
Files
  • main.hs
main.hs
1
2
3
4
5
6
7
8
9
10
11
divide :: Int -> Int -> Either [Char] Int
divide dividend divisor
    | (divisor == 0) = Left "Sorry, 0 is not allowed :o"
    | (dividend == (minBound :: Int)) && (divisor == -1) = Left "somethig went wrong"
    | otherwise = Right (dividend `div` divisor)


main = do
  print (divide 4 2)
  print (divide 4 0)
  print (divide (minBound :: Int) (-1))
GHCi, version 8.6.5