[project @ 1997-05-26 04:50:07 by sof]
[ghc-hetmet.git] / ghc / compiler / deSugar / DsCCall.lhs
index e8f20fa..a57a3a2 100644 (file)
@@ -10,6 +10,7 @@ module DsCCall ( dsCCall ) where
 
 IMP_Ubiq()
 
+import CmdLineOpts (opt_PprUserLength)
 import CoreSyn
 
 import DsMonad
@@ -18,13 +19,13 @@ import DsUtils
 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,
@@ -32,6 +33,7 @@ import TysWiredIn     ( getStatePairingConInfo,
                          stringTy
                        )
 import Util            ( pprPanic, pprError, panic )
+
 \end{code}
 
 Desugaring of @ccall@s consists of adding some state manipulation,
@@ -98,7 +100,7 @@ dsCCall label args may_gc is_asm result_ty
 
 \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
@@ -106,6 +108,13 @@ 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)
 
@@ -165,7 +174,7 @@ unboxArg arg
 
 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}