Simple Haskell calculator, using Maybe for error handling
I'd further suggest to split compute into two parts:


Getting the right operation from a given character:

op :: Char -&gt; Maybe (Double -&gt; Double -&gt; Double)
op '*' = Just (*)
op '/' = Just (/)
op '+' = Just (+)
op '-' = Just (-)
op _   = Nothing


This accepts a character, and either produces a function corresponding to the character, or Nothing.
Applying the operation on values, taking into account all possible Maybes:

compute' :: Maybe Char -&gt; Maybe Double -&gt; Maybe Double -&gt; Maybe Double
compute' c x y = (c &gt;&gt;= op) &lt;*&gt; x &lt;*&gt; y


Here c &gt;&gt;= op results into Maybe (Double -&gt; Double -&gt; Double), where the result is Nothing if the character is Nothing or if it doesn't match any supported operation. And then we use twice &lt;*&gt; from Control.Applicative, which, specialized for Maybe, applies Maybe (a -&gt; b) to Maybe a yelding Maybe b.