I wrote the following function in haskell

```
payment ::  [(Integer , Integer)] -> Integer ->  [(Integer , Integer)] -> Maybe  [(Integer , Integer)]
payment portemonnaie amount cashier | content (fromJust (pay portemonnaie amount)) - amount == 0 = Just []
                                    | pay portemonnaie amount == Nothing = Nothing
                                    | otherwise = payExact cashier (content (fromJust (pay portemonnaie amount)) - amount)

```

The problem here is: The function pay returns a Maybe type. So when the function 'pay' returns Nothing I get the following exception:

```
*** Exception: Maybe.fromJust: Nothing

```

I tried to prevent that by asking:

```
| pay portemonnaie amount == Nothing = Nothing

```

But apparently this is not possible. Does anybody have a more smarter way to build around this? Thank you