-type SyntaxName = Name -- These names are filled in by the renamer
- -- Before then they are a placeHolderName (so that
- -- we can still print the HsSyn)
- -- They correspond to "rebindable syntax";
- -- See RnEnv.lookupSyntaxName
-
-placeHolderName :: SyntaxName
-placeHolderName = mkInternalName unboundKey
- (mkVarOcc FSLIT("syntaxPlaceHolder"))
- noSrcLoc
+\begin{code}
+type LBangType name = Located (BangType name)
+type BangType name = HsType name -- Bangs are in the HsType data type
+
+data HsBang = HsNoBang -- Only used as a return value for getBangStrictness,
+ -- never appears on a HsBangTy
+ | HsStrict -- !
+ | HsUnbox -- {-# UNPACK #-} ! (GHC extension, meaning "unbox")
+
+instance Outputable HsBang where
+ ppr (HsNoBang) = empty
+ ppr (HsStrict) = char '!'
+ ppr (HsUnbox) = ptext SLIT("!!")
+
+getBangType :: LHsType a -> LHsType a
+getBangType (L _ (HsBangTy _ ty)) = ty
+getBangType ty = ty
+
+getBangStrictness :: LHsType a -> HsBang
+getBangStrictness (L _ (HsBangTy s _)) = s
+getBangStrictness _ = HsNoBang