import RdrHsSyn ( mkHsOpApp, RdrNameMonoBinds, RdrNameHsExpr, RdrNamePat )
import RdrName ( RdrName, mkUnqual )
import BasicTypes ( RecFlag(..), Fixity(..), FixityDirection(..)
- , maxPrecedence, defaultFixity
+ , maxPrecedence
, Boxity(..)
)
import FieldLabel ( fieldLabelName )
isDataSymOcc, isSymOcc
)
+import HscTypes ( FixityEnv, lookupFixity )
import PrelInfo -- Lots of RdrNames
import SrcLoc ( generatedSrcLoc, SrcLoc )
import TyCon ( TyCon, isNewTyCon, tyConDataCons, isEnumerationTyCon,
import Util ( mapAccumL, zipEqual, zipWithEqual, isSingleton,
zipWith3Equal, nOfThem )
import Panic ( panic, assertPanic )
-import Maybes ( maybeToBool, orElse )
+import Maybes ( maybeToBool )
import Constants
import List ( partition, intersperse )
%************************************************************************
\begin{code}
-gen_Read_binds :: (Name -> Maybe Fixity) -> TyCon -> RdrNameMonoBinds
+gen_Read_binds :: FixityEnv -> TyCon -> RdrNameMonoBinds
gen_Read_binds get_fixity tycon
= reads_prec `AndMonoBinds` read_list
%************************************************************************
\begin{code}
-gen_Show_binds :: (Name -> Maybe Fixity) -> TyCon -> RdrNameMonoBinds
+gen_Show_binds :: FixityEnv -> TyCon -> RdrNameMonoBinds
gen_Show_binds get_fixity tycon
= shows_prec `AndMonoBinds` show_list
\end{code}
\begin{code}
-getLRPrecs :: Bool -> (Name -> Maybe Fixity) -> Name -> [Integer]
+getLRPrecs :: Bool -> FixityEnv -> Name -> [Integer]
getLRPrecs is_infix get_fixity nm = [lp, rp]
where
{-
defaultPrecedence :: Integer
defaultPrecedence = fromInt maxPrecedence
-getPrecedence :: (Name -> Maybe Fixity) -> Name -> Integer
+getPrecedence :: FixityEnv -> Name -> Integer
getPrecedence get_fixity nm
- = case get_fixity nm of
- Just (Fixity x _) -> fromInt x
- other -> defaultPrecedence
+ = case lookupFixity get_fixity nm of
+ Fixity x _ -> fromInt x
-isLRAssoc :: (Name -> Maybe Fixity) -> Name -> (Bool, Bool)
+isLRAssoc :: FixityEnv -> Name -> (Bool, Bool)
isLRAssoc get_fixity nm =
- case get_fixity nm `orElse` defaultFixity of
+ case lookupFixity get_fixity nm of
Fixity _ InfixN -> (False, False)
Fixity _ InfixR -> (False, True)
Fixity _ InfixL -> (True, False)