Add an ext_name string to foreign dotnet types.
import CStrings ( CLabelString )
import Outputable
import SrcLoc ( SrcLoc )
+import FastString
\end{code}
tcdLoc :: SrcLoc
}
- | ForeignType { tcdName :: name, -- See remarks about IfaceSig above
- tcdFoType :: FoType,
- tcdLoc :: SrcLoc }
+ | ForeignType { tcdName :: name, -- See remarks about IfaceSig above
+ tcdExtName :: Maybe FastString,
+ tcdFoType :: FoType,
+ tcdLoc :: SrcLoc }
| TyData { tcdND :: NewOrData,
tcdCtxt :: HsContext name, -- context
{-
-----------------------------------------------------------------------------
-$Id: Parser.y,v 1.67 2001/06/11 12:21:17 simonpj Exp $
+$Id: Parser.y,v 1.68 2001/06/13 15:50:57 rrt Exp $
Haskell grammar.
| srcloc 'import' 'dotnet' ext_name varid '::' sigtype
{ ForD (ForeignImport $5 $7 (DNImport (DNCallSpec ($4 `orElse` mkExtName $5))) $1) }
- | srcloc 'import' 'dotnet' 'type' tycon
- { TyClD (ForeignType $5 DNType $1) }
+ | srcloc 'import' 'dotnet' 'type' ext_name tycon
+ { TyClD (ForeignType $6 $5 DNType $1) }
decls :: { [RdrBinding] }
: decls ';' decl { $3 : $1 }
| src_loc 'type' qtc_name tv_bndrs '=' type
{ TySynonym $3 $4 $6 $1 }
| src_loc 'foreign' 'type' qtc_name
- { ForeignType $4 DNType $1 }
+ { ForeignType $4 Nothing DNType $1 }
| src_loc 'data' opt_decl_context qtc_name tv_bndrs constrs
{ mkTyData DataType $3 $4 $5 $6 (length $6) Nothing $1 }
| src_loc 'newtype' opt_decl_context qtc_name tv_bndrs newtype_constr
sectionPrecErr op arg_op section
= vcat [ptext SLIT("The operator") <+> ppr_opfix op <+> ptext SLIT("of a section"),
nest 4 (ptext SLIT("must have lower precedence than the operand") <+> ppr_opfix arg_op),
- nest 4 (ptext SLIT("In the section:") <+> quotes (ppr section))]
+ nest 4 (ptext SLIT("in the section:") <+> quotes (ppr section))]
nonStdGuardErr guard
= hang (ptext
| otherwise -> DataTyCon
buildTyConOrClass dflags is_rec kenv rec_vrcs rec_details
- (ForeignType {tcdName = tycon_name})
- = ATyCon (mkForeignTyCon tycon_name liftedTypeKind 0 [])
+ (ForeignType {tcdName = tycon_name, tcdExtName = tycon_ext_name})
+ = ATyCon (mkForeignTyCon tycon_name tycon_ext_name liftedTypeKind 0 [])
buildTyConOrClass dflags is_rec kenv rec_vrcs rec_details
(ClassDecl {tcdName = class_name, tcdTyVars = tyvar_names,
import PrelNames ( Unique, Uniquable(..), anyBoxConKey )
import PrimRep ( PrimRep(..), isFollowableRep )
import Outputable
+import FastString
\end{code}
%************************************************************************
primTyConRep :: PrimRep, -- Many primitive tycons are unboxed, but some are
-- boxed (represented by pointers). The PrimRep tells.
- isUnLifted :: Bool -- Most primitive tycons are unlifted,
+ isUnLifted :: Bool, -- Most primitive tycons are unlifted,
-- but foreign-imported ones may not be
+ tyConExtName :: Maybe FastString
}
| TupleTyCon {
}
-- Foreign-imported (.NET) type constructors are represented
--- as primitive, but *lifted*, TyCons for now.
--- They have PtrRep
-mkForeignTyCon name kind arity arg_vrcs
+-- as primitive, but *lifted*, TyCons for now. They are lifted
+-- because the Haskell type T representing the (foreign) .NET
+-- type T is actually implemented (in ILX) as a thunk<T>
+-- They have PtrRep
+mkForeignTyCon name ext_name kind arity arg_vrcs
= PrimTyCon {
tyConName = name,
tyConUnique = nameUnique name,
tyConArity = arity,
tyConArgVrcs = arg_vrcs,
primTyConRep = PtrRep,
- isUnLifted = False
+ isUnLifted = False,
+ tyConExtName = ext_name
}
tyConArity = arity,
tyConArgVrcs = arg_vrcs,
primTyConRep = rep,
- isUnLifted = True
+ isUnLifted = True,
+ tyConExtName = Nothing
}
mkSynTyCon name kind arity tyvars rhs argvrcs