From d8751f2cced8f14366533ff0dbbc62fa73ec8665 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 16 Mar 2020 10:50:03 +0100 Subject: Clean parser for expression containing rational and imaginary --- src/atom.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/atom.hs') diff --git a/src/atom.hs b/src/atom.hs index d01b157..5f1b42c 100644 --- a/src/atom.hs +++ b/src/atom.hs @@ -30,6 +30,10 @@ _ /? (ARational 0) = Nothing (ARational a) /? (ARational b) = Just $ ARational (a / b) _ /? _ = Nothing +infixl 7 %? +(%?) :: Atom -> Atom -> Maybe Atom +_ %? _ = Nothing + infixr 8 ^? (^?) :: Atom -> Atom -> Maybe Atom (ARational a) ^? (ARational b) = Just $ ARational (a ** b) -- cgit