-
-getFixity :: Fixities -> Name -> Integer
-getFixity fixs_assoc nm =
- case assocMaybe fixs_assoc nm of
- Nothing -> 9
- Just (Fixity x _) -> fromInt x + 1
-
-isLRAssoc :: Fixities -> Name -> (Bool, Bool)
-isLRAssoc fixs_assoc nm =
- case assocMaybe fixs_assoc nm of
- Just (Fixity _ InfixL) -> (True, False)
- Just (Fixity _ InfixR) -> (False, True)
- _ -> (False, False)
+defaultPrecedence :: Integer
+defaultPrecedence = fromInt maxPrecedence
+
+getPrecedence :: (Name -> Maybe Fixity) -> Name -> Integer
+getPrecedence get_fixity nm
+ = case get_fixity nm of
+ Just (Fixity x _) -> fromInt x
+ other -> defaultPrecedence
+
+isLRAssoc :: (Name -> Maybe Fixity) -> Name -> (Bool, Bool)
+isLRAssoc get_fixity nm =
+ case get_fixity nm `orElse` defaultFixity of
+ Fixity _ InfixN -> (False, False)
+ Fixity _ InfixR -> (False, True)
+ Fixity _ InfixL -> (True, False)