diff options
Diffstat (limited to 'app/Operators.hs')
| -rw-r--r-- | app/Operators.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/Operators.hs b/app/Operators.hs index 8bf7c1e..2beb875 100644 --- a/app/Operators.hs +++ b/app/Operators.hs @@ -26,6 +26,17 @@ numArgs (Op _ f) = go f type Ops = [(String, Op)] +argKind :: Char -> Maybe ArgKind +argKind 'x' = Just X +argKind 'y' = Just Y +argKind _ = Nothing + +fixity :: String -> Maybe Fixity +fixity [l, 'f', r] = Infix <$> argKind l <*> argKind r +fixity ['f', x] = Prefix <$> argKind x +fixity [x, 'f'] = Suffix <$> argKind x +fixity _ = Nothing + xfx, xfy, yfx, fx, fy, xf, yf :: String -> Int -> (String, Op) xfx o p = (o, Op p (Infix X X)) |
