summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/ForeignCall.hs12
-rw-r--r--compiler/prelude/PrimOp.hs3
-rw-r--r--compiler/prelude/TysWiredIn.hs30
3 files changed, 27 insertions, 18 deletions
diff --git a/compiler/prelude/ForeignCall.hs b/compiler/prelude/ForeignCall.hs
index 8411f11e71..ff893ede02 100644
--- a/compiler/prelude/ForeignCall.hs
+++ b/compiler/prelude/ForeignCall.hs
@@ -22,7 +22,7 @@ import FastString
import Binary
import Outputable
import Module
-import BasicTypes ( SourceText )
+import BasicTypes ( SourceText, pprWithSourceText )
import Data.Char
import Data.Data
@@ -203,14 +203,14 @@ instance Outputable CCallSpec where
gc_suf | playSafe safety = text "_GC"
| otherwise = empty
- ppr_fun (StaticTarget _ fn mPkgId isFun)
+ ppr_fun (StaticTarget st _fn mPkgId isFun)
= text (if isFun then "__pkg_ccall"
else "__pkg_ccall_value")
<> gc_suf
<+> (case mPkgId of
Nothing -> empty
Just pkgId -> ppr pkgId)
- <+> pprCLabelString fn
+ <+> (pprWithSourceText st empty)
ppr_fun DynamicTarget
= text "__dyn_ccall" <> gc_suf <+> text "\"\""
@@ -221,7 +221,7 @@ data Header = Header SourceText FastString
deriving (Eq, Data)
instance Outputable Header where
- ppr (Header _ h) = quotes $ ppr h
+ ppr (Header st h) = pprWithSourceText st (doubleQuotes $ ppr h)
-- | A C type, used in CAPI FFI calls
--
@@ -236,7 +236,9 @@ data CType = CType SourceText -- Note [Pragma source text] in BasicTypes
deriving (Eq, Data)
instance Outputable CType where
- ppr (CType _ mh (_,ct)) = hDoc <+> ftext ct
+ ppr (CType stp mh (stct,ct))
+ = pprWithSourceText stp (text "{-# CTYPE") <+> hDoc
+ <+> pprWithSourceText stct (doubleQuotes (ftext ct)) <+> text "#-}"
where hDoc = case mh of
Nothing -> empty
Just h -> ppr h
diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs
index e174aedcf4..0acac6639f 100644
--- a/compiler/prelude/PrimOp.hs
+++ b/compiler/prelude/PrimOp.hs
@@ -38,7 +38,8 @@ import OccName ( OccName, pprOccName, mkVarOccFS )
import TyCon ( TyCon, isPrimTyCon, PrimRep(..) )
import Type
import RepType ( typePrimRep, tyConPrimRep )
-import BasicTypes ( Arity, Fixity(..), FixityDirection(..), Boxity(..) )
+import BasicTypes ( Arity, Fixity(..), FixityDirection(..), Boxity(..),
+ SourceText(..) )
import ForeignCall ( CLabelString )
import Unique ( Unique, mkPrimOpIdUnique )
import Outputable
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 1c47922a36..18cf53093d 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -144,7 +144,8 @@ import Class ( Class, mkClass )
import RdrName
import Name
import NameSet ( NameSet, mkNameSet, elemNameSet )
-import BasicTypes ( Arity, Boxity(..), TupleSort(..), ConTagZ )
+import BasicTypes ( Arity, Boxity(..), TupleSort(..), ConTagZ,
+ SourceText(..) )
import ForeignCall
import SrcLoc ( noSrcSpan )
import Unique
@@ -525,7 +526,7 @@ pcDataConWithFixity' declared_infix dc_name wrk_key rri tyvars ex_tyvars arg_tys
(mkDataConWorkId wrk_name data_con)
NoDataConRep -- Wired-in types are too simple to need wrappers
- no_bang = HsSrcBang Nothing NoSrcUnpack NoSrcStrict
+ no_bang = HsSrcBang NoSourceText NoSrcUnpack NoSrcStrict
wrk_name = mkDataConWorkerName data_con wrk_key
@@ -1179,8 +1180,9 @@ charTy = mkTyConTy charTyCon
charTyCon :: TyCon
charTyCon = pcNonEnumTyCon charTyConName
- (Just (CType "" Nothing ("HsChar",fsLit "HsChar")))
- [] [charDataCon]
+ (Just (CType NoSourceText Nothing
+ (NoSourceText,fsLit "HsChar")))
+ [] [charDataCon]
charDataCon :: DataCon
charDataCon = pcDataCon charDataConName [] [charPrimTy] charTyCon
@@ -1192,8 +1194,8 @@ intTy = mkTyConTy intTyCon
intTyCon :: TyCon
intTyCon = pcNonEnumTyCon intTyConName
- (Just (CType "" Nothing ("HsInt",fsLit "HsInt"))) []
- [intDataCon]
+ (Just (CType NoSourceText Nothing (NoSourceText,fsLit "HsInt")))
+ [] [intDataCon]
intDataCon :: DataCon
intDataCon = pcDataCon intDataConName [] [intPrimTy] intTyCon
@@ -1202,8 +1204,8 @@ wordTy = mkTyConTy wordTyCon
wordTyCon :: TyCon
wordTyCon = pcNonEnumTyCon wordTyConName
- (Just (CType "" Nothing ("HsWord", fsLit "HsWord"))) []
- [wordDataCon]
+ (Just (CType NoSourceText Nothing (NoSourceText, fsLit "HsWord")))
+ [] [wordDataCon]
wordDataCon :: DataCon
wordDataCon = pcDataCon wordDataConName [] [wordPrimTy] wordTyCon
@@ -1212,7 +1214,8 @@ word8Ty = mkTyConTy word8TyCon
word8TyCon :: TyCon
word8TyCon = pcNonEnumTyCon word8TyConName
- (Just (CType "" Nothing ("HsWord8", fsLit "HsWord8"))) []
+ (Just (CType NoSourceText Nothing
+ (NoSourceText, fsLit "HsWord8"))) []
[word8DataCon]
word8DataCon :: DataCon
word8DataCon = pcDataCon word8DataConName [] [wordPrimTy] word8TyCon
@@ -1222,7 +1225,8 @@ floatTy = mkTyConTy floatTyCon
floatTyCon :: TyCon
floatTyCon = pcNonEnumTyCon floatTyConName
- (Just (CType "" Nothing ("HsFloat", fsLit "HsFloat"))) []
+ (Just (CType NoSourceText Nothing
+ (NoSourceText, fsLit "HsFloat"))) []
[floatDataCon]
floatDataCon :: DataCon
floatDataCon = pcDataCon floatDataConName [] [floatPrimTy] floatTyCon
@@ -1232,7 +1236,8 @@ doubleTy = mkTyConTy doubleTyCon
doubleTyCon :: TyCon
doubleTyCon = pcNonEnumTyCon doubleTyConName
- (Just (CType "" Nothing ("HsDouble",fsLit "HsDouble"))) []
+ (Just (CType NoSourceText Nothing
+ (NoSourceText,fsLit "HsDouble"))) []
[doubleDataCon]
doubleDataCon :: DataCon
@@ -1293,7 +1298,8 @@ boolTy = mkTyConTy boolTyCon
boolTyCon :: TyCon
boolTyCon = pcTyCon True boolTyConName
- (Just (CType "" Nothing ("HsBool", fsLit "HsBool")))
+ (Just (CType NoSourceText Nothing
+ (NoSourceText, fsLit "HsBool")))
[] [falseDataCon, trueDataCon]
falseDataCon, trueDataCon :: DataCon