extractHsCtxtRdrTyVars, extractGenericPatTyVars,
mkHsOpApp, mkClassDecl, mkClassOpSig, mkConDecl,
- mkHsNegApp, mkHsIntegralLit, mkHsFractionalLit, mkNPlusKPatIn,
-
-
- -- some built-in names (all :: RdrName)
- unitCon_RDR, unitTyCon_RDR, nilCon_RDR, listTyCon_RDR,
- tupleCon_RDR, tupleTyCon_RDR, ubxTupleCon_RDR, ubxTupleTyCon_RDR,
- funTyCon_RDR,
+ mkHsNegApp,
cvBinds,
cvMonoBindsAndSigs,
#include "HsVersions.h"
import HsSyn -- Lots of it
-import CmdLineOpts ( opt_NoImplicitPrelude )
import HsPat ( collectSigTysFromPats )
import OccName ( mkClassTyConOcc, mkClassDataConOcc, mkWorkerOcc,
mkSuperDictSelOcc, mkDefaultMethodOcc, mkGenOcc1,
- mkGenOcc2, varName, dataName, tcName
+ mkGenOcc2,
)
-import PrelNames ( pRELUDE_Name, mkTupNameStr )
+import PrelNames ( negate_RDR )
import RdrName ( RdrName, isRdrTyVar, mkRdrUnqual, rdrNameOcc,
- mkUnqual, mkPreludeQual
)
import List ( nub )
-import BasicTypes ( Boxity(..), RecFlag(..) )
+import BasicTypes ( RecFlag(..) )
import Class ( DefMeth (..) )
\end{code}
mkHsNegApp (HsOverLit (HsIntegral i n)) = HsOverLit (HsIntegral (-i) n)
mkHsNegApp (HsOverLit (HsFractional f n)) = HsOverLit (HsFractional (-f) n)
-
-mkHsNegApp expr = NegApp expr (prelQual varName SLIT("negate"))
-\end{code}
-
-\begin{code}
-mkHsIntegralLit :: Integer -> HsOverLit RdrName
-mkHsIntegralLit i = HsIntegral i (prelQual varName SLIT("fromInteger"))
-
-mkHsFractionalLit :: Rational -> HsOverLit RdrName
-mkHsFractionalLit f = HsFractional f (prelQual varName SLIT("fromRational"))
-
-mkNPlusKPatIn :: RdrName -> HsOverLit RdrName -> RdrNamePat
-mkNPlusKPatIn n k = NPlusKPatIn n k (prelQual varName SLIT("-"))
+mkHsNegApp expr = NegApp expr negate_RDR
\end{code}
A useful function for building @OpApps@. The operator is always a
mkHsOpApp e1 op e2 = OpApp e1 (HsVar op) (error "mkOpApp:fixity") e2
\end{code}
-\begin{code}
------------------------------------------------------------------------------
--- Built-in names
--- Qualified Prelude names are always in scope; so we can just say Prelude.[]
--- for the list type constructor, say. But it's not so easy when we say
--- -fno-implicit-prelude. Then you just get whatever "[]" happens to be in scope.
-
-unitCon_RDR, unitTyCon_RDR, nilCon_RDR, listTyCon_RDR :: RdrName
-tupleCon_RDR, tupleTyCon_RDR :: Int -> RdrName
-ubxTupleCon_RDR, ubxTupleTyCon_RDR :: Int -> RdrName
-
-unitCon_RDR = prelQual dataName SLIT("()")
-unitTyCon_RDR = prelQual tcName SLIT("()")
-nilCon_RDR = prelQual dataName SLIT("[]")
-listTyCon_RDR = prelQual tcName SLIT("[]")
-funTyCon_RDR = prelQual tcName SLIT("(->)")
-tupleCon_RDR arity = prelQual dataName (snd (mkTupNameStr Boxed arity))
-tupleTyCon_RDR arity = prelQual tcName (snd (mkTupNameStr Boxed arity))
-ubxTupleCon_RDR arity = prelQual dataName (snd (mkTupNameStr Unboxed arity))
-ubxTupleTyCon_RDR arity = prelQual tcName (snd (mkTupNameStr Unboxed arity))
-
-prelQual ns occ | opt_NoImplicitPrelude = mkUnqual ns occ
- | otherwise = mkPreludeQual ns pRELUDE_Name occ
-\end{code}
%************************************************************************
%* *