aboutsummaryrefslogtreecommitdiff
path: root/src/atom.hs
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-03-16 10:50:03 +0100
committerCharles <sircharlesaze@gmail.com>2020-03-16 10:50:03 +0100
commitd8751f2cced8f14366533ff0dbbc62fa73ec8665 (patch)
treee216acbfb3d91cfe25870af93626240dbc7afcb3 /src/atom.hs
parentcc2593028c5f380e177adbf8905a43d665ac64cf (diff)
downloadcomputorv2-d8751f2cced8f14366533ff0dbbc62fa73ec8665.tar.gz
computorv2-d8751f2cced8f14366533ff0dbbc62fa73ec8665.tar.bz2
computorv2-d8751f2cced8f14366533ff0dbbc62fa73ec8665.zip
Clean parser for expression containing rational and imaginary
Diffstat (limited to 'src/atom.hs')
-rw-r--r--src/atom.hs4
1 files changed, 4 insertions, 0 deletions
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)