diff --git a/hsilop.hs b/hsilop.hs index d346229..d52ce2e 100644 --- a/hsilop.hs +++ b/hsilop.hs @@ -27,9 +27,8 @@ rpn = foldM parse [] . words >=> return . head where parse (y:x:xs) (flip lookup dyad -> Just f) = Right (f x y : xs) parse (x:xs) (flip lookup monad -> Just f) = Right (f x : xs) parse xs (flip lookup nilad -> Just k) = Right (k : xs) - parse xs x = case readMaybe x of - Just x -> Right (x : xs) - Nothing -> Left "syntax error" + parse xs (readMaybe -> Just x) = Right (x : xs) + parse xs _ = Left "syntax error" -- dyadic functions