演習問題
問題6
おれおれbindとreturnで。
expr' :: Parser Int expr' = term' >>- \t -> (symbol "+" >>- \d -> expr' >>- \e -> return' (t + e)) +++ (symbol "-" >>- \d -> expr' >>- \e -> return' (t - e)) +++ return' t term' :: Parser Int term' = factor >>- \f -> (symbol "*" >>- \d -> term' >>- \t -> return' (f * t)) +++ (symbol "/" >>- \d -> term' >>- \t -> return' (f `div` t)) +++ return' f