IMP_Ubiq()
+import CmdLineOpts (opt_PprUserLength)
import CoreSyn
import DsMonad
import CoreUtils ( coreExprType )
import Id ( dataConArgTys )
import Maybes ( maybeToBool )
-import PprStyle ( PprStyle(..) )
+import Outputable ( PprStyle(..), Outputable(..) )
import PprType ( GenType{-instances-} )
import Pretty
import PrelVals ( packStringForCId )
import PrimOp ( PrimOp(..) )
import Type ( isPrimType, maybeAppDataTyConExpandingDicts, maybeAppTyCon,
- eqTy, maybeBoxedPrimType )
+ eqTy, maybeBoxedPrimType, SYN_IE(Type) )
import TysPrim ( byteArrayPrimTy, realWorldTy, realWorldStatePrimTy,
byteArrayPrimTyCon, mutableByteArrayPrimTyCon )
import TysWiredIn ( getStatePairingConInfo,
stringTy
)
import Util ( pprPanic, pprError, panic )
+
\end{code}
Desugaring of @ccall@s consists of adding some state manipulation,
\begin{code}
unboxArg :: CoreExpr -- The supplied argument
- -> DsM (CoreExpr, -- To pass as the actual argument
+ -> DsM (CoreExpr, -- To pass as the actual argument
CoreExpr -> CoreExpr -- Wrapper to unbox the arg
)
unboxArg arg
-- Primitive types
-- ADR Question: can this ever be used? None of the PrimTypes are
-- instances of the CCallable class.
+ --
+ -- SOF response:
+ -- Oh yes they are, I've just added them :-) Having _ccall_ and _casm_
+ -- that accept unboxed arguments is a Good Thing if you have a stub generator
+ -- which generates the boiler-plate box-unbox code for you, i.e., it may help
+ -- us nuke this very module :-)
+ --
| isPrimType arg_ty
= returnDs (arg, \body -> body)
can't_see_datacons_error thing ty
= pprError "ERROR: Can't see the data constructor(s) for _ccall_/_casm_ "
- (ppBesides [ppStr thing, ppStr "; type: ", ppr PprForUser ty])
+ (hcat [text thing, text "; type: ", ppr (PprForUser opt_PprUserLength) ty])
\end{code}