Saved pastes by polux:
1 2 3 4 5
parse :: String -> Either Double (Double -> Double -> Double) parse s = maybe (Left $ read s) Right (lookup s ops) where ops = zip ["+","-","*","/"] [(+),(-),(*),(/)] go :: [Double] -> [String] -> [Double]