Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
Error Monad
Sign in to test your solution.
data Ofwel e a = Rechts a
| Links e
deriving (Show, Eq)
-- | Ofwel het exacte resultaat van een gehele deling, ofwel een foutboodschap.
safeDiv :: Int -> Int -> Ofwel String Int
safeDiv x y | y == 0 = Links "can't divide by zero"
| x `mod` y /= 0 = Links "not exact"
| otherwise = Rechts (x `div` y)
instance Functor (Ofwel e) where
fmap = undefined
instance Applicative (Ofwel e) where
pure = undefined
(<*>) = undefined
instance Monad (Ofwel e) where
return = undefined
(>>=) = undefined
-- | Kunnen we x appels en y peren eerlijk verdelen over z kinderen? Hoeveel vruchten krijgt elk?
sharing :: Int -> Int -> Int -> Ofwel String Int
sharing x y z = undefined
-- | Ofwel het n-de element van de lijst, ofwel een foutboodschap.
(!!?) :: [a] -> Int -> Ofwel String a
l !!? n = undefined
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.