summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-12-23 15:26:36 +0100
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-12-24 15:27:35 +0100
commit5ea88588be7bc67d5e2e2e72922db8a77e56e7a6 (patch)
tree77b8d253134f2fea6edcfc56d4ba4481ff68a854
parent9552781abf3d199d01b01ed4b7d04abdc54b6b26 (diff)
downloadhaskell-wip/no-nopolykinds.tar.gz
WIP on NoNoPolyKindswip/no-nopolykinds
-rwxr-xr-x.gitlab/ci.sh2
-rw-r--r--compiler/GHC/Core/TyCo/Rep.hs-boot5
-rw-r--r--compiler/GHC/Driver/Session.hs7
-rw-r--r--compiler/GHC/Rename/HsType.hs31
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs7
-rw-r--r--compiler/GHC/Tc/Module.hs1
-rw-r--r--compiler/GHC/Tc/Solver.hs12
-rw-r--r--compiler/GHC/Tc/TyCl.hs2
-rw-r--r--compiler/GHC/Tc/Utils/TcMType.hs39
-rw-r--r--compiler/GHC/Types/Basic.hs15
-rw-r--r--compiler/GHC/Types/Var.hs-boot5
-rw-r--r--libraries/base/GHC/Base.hs-boot8
-rw-r--r--libraries/base/GHC/ForeignPtr.hs4
-rw-r--r--libraries/base/GHC/Ptr.hs5
-rw-r--r--libraries/base/GHC/Real.hs-boot6
-rw-r--r--libraries/ghci/GHCi/RemoteTypes.hs7
16 files changed, 43 insertions, 113 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index 054e429042..252b33553b 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -538,7 +538,7 @@ function cabal_test() {
-hidir tmp -odir tmp -fforce-recomp \
-dumpdir "$OUT/dumps" -ddump-timings \
+RTS --machine-readable "-t$OUT/rts.log" -RTS \
- -ilibraries/Cabal/Cabal/src -XNoPolyKinds Distribution.Simple \
+ -ilibraries/Cabal/Cabal/src Distribution.Simple \
"$@" 2>&1 | tee $OUT/log
rm -Rf tmp
end_section "Cabal test: $OUT"
diff --git a/compiler/GHC/Core/TyCo/Rep.hs-boot b/compiler/GHC/Core/TyCo/Rep.hs-boot
index f2e59d534f..1860de5b96 100644
--- a/compiler/GHC/Core/TyCo/Rep.hs-boot
+++ b/compiler/GHC/Core/TyCo/Rep.hs-boot
@@ -1,8 +1,9 @@
-{-# LANGUAGE NoPolyKinds #-}
+{-# LANGUAGE KindSignatures #-}
module GHC.Core.TyCo.Rep where
import GHC.Utils.Outputable ( Outputable )
import Data.Data ( Data )
+import qualified Data.Kind as K
import {-# SOURCE #-} GHC.Types.Var( Var, ArgFlag, AnonArgFlag )
import {-# SOURCE #-} GHC.Core.TyCon ( TyCon )
@@ -13,7 +14,7 @@ data TyLit
data TyCoBinder
data MCoercion
-data Scaled a
+data Scaled (a :: K.Type)
type Mult = Type
type PredType = Type
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index d1c29bc824..9d9e1c3413 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -1321,12 +1321,13 @@ languageExtensions (Just Haskell98)
LangExt.DatatypeContexts,
LangExt.TraditionalRecordSyntax,
LangExt.FieldSelectors,
- LangExt.NondecreasingIndentation
+ LangExt.NondecreasingIndentation,
-- strictly speaking non-standard, but we always had this
-- on implicitly before the option was added in 7.1, and
-- turning it off breaks code, so we're keeping it on for
-- backwards compatibility. Cabal uses -XHaskell98 by
-- default unless you specify another language.
+ LangExt.PolyKinds
]
languageExtensions (Just Haskell2010)
@@ -1342,7 +1343,8 @@ languageExtensions (Just Haskell2010)
LangExt.PatternGuards,
LangExt.DoAndIfThenElse,
LangExt.FieldSelectors,
- LangExt.RelaxedPolyRec]
+ LangExt.RelaxedPolyRec,
+ LangExt.PolyKinds]
languageExtensions (Just GHC2021)
= [LangExt.ImplicitPrelude,
@@ -1356,6 +1358,7 @@ languageExtensions (Just GHC2021)
LangExt.DoAndIfThenElse,
LangExt.FieldSelectors,
LangExt.RelaxedPolyRec,
+ LangExt.PolyKinds,
-- Now the new extensions (not in Haskell2010)
LangExt.BangPatterns,
LangExt.BinaryLiterals,
diff --git a/compiler/GHC/Rename/HsType.hs b/compiler/GHC/Rename/HsType.hs
index 6740e02430..89c5122fdf 100644
--- a/compiler/GHC/Rename/HsType.hs
+++ b/compiler/GHC/Rename/HsType.hs
@@ -372,9 +372,6 @@ rnHsSigType ctx level
(L loc sig_ty@(HsSig { sig_bndrs = outer_bndrs, sig_body = body }))
= setSrcSpanA loc $
do { traceRn "rnHsSigType" (ppr sig_ty)
- ; case outer_bndrs of
- HsOuterExplicit{} -> checkPolyKinds env sig_ty
- HsOuterImplicit{} -> pure ()
; imp_vars <- filterInScopeM $ extractHsTyRdrTyVars body
; bindHsOuterTyVarBndrs ctx Nothing imp_vars outer_bndrs $ \outer_bndrs' ->
do { (body', fvs) <- rnLHsTyKi env body
@@ -604,9 +601,8 @@ rnLHsTyKi env (L loc ty)
rnHsTyKi :: RnTyKiEnv -> HsType GhcPs -> RnM (HsType GhcRn, FreeVars)
-rnHsTyKi env ty@(HsForAllTy { hst_tele = tele, hst_body = tau })
- = do { checkPolyKinds env ty
- ; bindHsForAllTelescope (rtke_ctxt env) tele $ \ tele' ->
+rnHsTyKi env (HsForAllTy { hst_tele = tele, hst_body = tau })
+ = do { bindHsForAllTelescope (rtke_ctxt env) tele $ \ tele' ->
do { (tau', fvs) <- rnLHsTyKi env tau
; return ( HsForAllTy { hst_xforall = noExtField
, hst_tele = tele' , hst_body = tau' }
@@ -623,14 +619,7 @@ rnHsTyKi env ty@(HsQualTy { hst_ctxt = lctxt, hst_body = tau })
, fvs1 `plusFV` fvs2) }
rnHsTyKi env (HsTyVar _ ip (L loc rdr_name))
- = do { when (isRnKindLevel env && isRdrTyVar rdr_name) $
- unlessXOptM LangExt.PolyKinds $ addErr $ TcRnUnknownMessage $ mkPlainError noHints $
- withHsDocContext (rtke_ctxt env) $
- vcat [ text "Unexpected kind variable" <+> quotes (ppr rdr_name)
- , text "Perhaps you intended to use PolyKinds" ]
- -- Any type variable at the kind level is illegal without the use
- -- of PolyKinds (see #14710)
- ; name <- rnTyVar env rdr_name
+ = do { name <- rnTyVar env rdr_name
; return (HsTyVar noAnn ip (L loc name), unitFV name) }
rnHsTyKi env ty@(HsOpTy _ ty1 l_op ty2)
@@ -908,20 +897,6 @@ wildCardsAllowed env
---------------
--- | Ensures either that we're in a type or that -XPolyKinds is set
-checkPolyKinds :: Outputable ty
- => RnTyKiEnv
- -> ty -- ^ type
- -> RnM ()
-checkPolyKinds env ty
- | isRnKindLevel env
- = do { polykinds <- xoptM LangExt.PolyKinds
- ; unless polykinds $
- addErr $ TcRnUnknownMessage $ mkPlainError noHints $
- (text "Illegal kind:" <+> ppr ty $$
- text "Did you mean to enable PolyKinds?") }
-checkPolyKinds _ _ = return ()
-
notInKinds :: Outputable ty
=> RnTyKiEnv
-> ty
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index 5353280438..66dba571cb 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -965,11 +965,8 @@ deriveInstanceErrReasonHints :: Class
-> UsingGeneralizedNewtypeDeriving
-> DeriveInstanceErrReason
-> [GhcHint]
-deriveInstanceErrReasonHints cls newtype_deriving = \case
- DerivErrNotWellKinded _ _ n_args_to_keep
- | cls `hasKey` gen1ClassKey && n_args_to_keep >= 0
- -> [suggestExtension LangExt.PolyKinds]
- | otherwise
+deriveInstanceErrReasonHints _ newtype_deriving = \case
+ DerivErrNotWellKinded _ _ _
-> noHints
DerivErrSafeHaskellGenericInst -> noHints
DerivErrDerivingViaWrongKind{} -> noHints
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 68bfba4448..cefb011dd5 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -2628,7 +2628,6 @@ tcRnType :: HscEnv
-> IO (Messages TcRnMessage, Maybe (Type, Kind))
tcRnType hsc_env flexi normalise rdr_type
= runTcInteractive hsc_env $
- setXOptM LangExt.PolyKinds $ -- See Note [Kind-generalise in tcRnType]
do { (HsWC { hswc_ext = wcs, hswc_body = rn_type }, _fvs)
<- rnHsWcType GHCiCtx (mkHsWildCardBndrs rdr_type)
-- The type can have wild cards, but no implicit
diff --git a/compiler/GHC/Tc/Solver.hs b/compiler/GHC/Tc/Solver.hs
index e276ad16d9..424b9555b7 100644
--- a/compiler/GHC/Tc/Solver.hs
+++ b/compiler/GHC/Tc/Solver.hs
@@ -1485,10 +1485,9 @@ defaultTyVarsAndSimplify rhs_tclvl mono_tvs candidates
-- the logic in decideMonoTyVars, which looks at
-- the constraints generated
- ; poly_kinds <- xoptM LangExt.PolyKinds
- ; default_kvs <- mapM (default_one poly_kinds True)
+ ; default_kvs <- mapM default_one
(dVarSetElems cand_kvs)
- ; default_tvs <- mapM (default_one poly_kinds False)
+ ; default_tvs <- mapM default_one
(dVarSetElems (cand_tvs `minusDVarSet` cand_kvs))
; let some_default = or default_kvs || or default_tvs
@@ -1498,17 +1497,14 @@ defaultTyVarsAndSimplify rhs_tclvl mono_tvs candidates
| otherwise -> return candidates
}
where
- default_one poly_kinds is_kind_var tv
+ default_one tv
| not (isMetaTyVar tv)
= return False
| tv `elemVarSet` mono_tvs
= return False
| otherwise
= defaultTyVar
- (if not poly_kinds && is_kind_var
- then DefaultKindVars
- else NonStandardDefaulting DefaultNonStandardTyVars)
- -- NB: only pass 'DefaultKindVars' when we know we're dealing with a kind variable.
+ (NonStandardDefaulting DefaultNonStandardTyVars)
tv
simplify_cand candidates
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs
index 798da08ec5..a8f2dcb852 100644
--- a/compiler/GHC/Tc/TyCl.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -674,7 +674,7 @@ kcTyClGroup kisig_env decls
-- 3. Generalise the inferred kinds
-- See Note [Kind checking for type and class decls]
- ; cusks_enabled <- xoptM LangExt.CUSKs <&&> xoptM LangExt.PolyKinds
+ ; cusks_enabled <- xoptM LangExt.CUSKs
-- See Note [CUSKs and PolyKinds]
; let (kindless_decls, kinded_decls) = partitionWith get_kind decls
kindless_names = mkNameSet $ map get_name kindless_decls
diff --git a/compiler/GHC/Tc/Utils/TcMType.hs b/compiler/GHC/Tc/Utils/TcMType.hs
index 699bf5f69a..b6fadb07c8 100644
--- a/compiler/GHC/Tc/Utils/TcMType.hs
+++ b/compiler/GHC/Tc/Utils/TcMType.hs
@@ -99,7 +99,6 @@ module GHC.Tc.Utils.TcMType (
import GHC.Prelude
import GHC.Driver.Session
-import qualified GHC.LanguageExtensions as LangExt
import GHC.Tc.Types.Origin
import GHC.Tc.Utils.Monad -- TcType, amongst others
@@ -1827,40 +1826,12 @@ defaultTyVar def_strat tv
; writeMetaTyVar tv manyDataConTy
; return True }
- | DefaultKindVars <- def_strat -- -XNoPolyKinds and this is a kind var: we must default it
- = default_kind_var tv
-
| otherwise
= return False
where
default_ns_vars :: Bool
default_ns_vars = defaultNonStandardTyVars def_strat
- default_kind_var :: TyVar -> TcM Bool
- -- defaultKindVar is used exclusively with -XNoPolyKinds
- -- See Note [Defaulting with -XNoPolyKinds]
- -- It takes an (unconstrained) meta tyvar and defaults it.
- -- Works only on vars of type *; for other kinds, it issues an error.
- default_kind_var kv
- | isLiftedTypeKind (tyVarKind kv)
- = do { traceTc "Defaulting a kind var to *" (ppr kv)
- ; writeMetaTyVar kv liftedTypeKind
- ; return True }
- | otherwise
- = do { addErr $ TcRnUnknownMessage $ mkPlainError noHints $
- (vcat [ text "Cannot default kind variable" <+> quotes (ppr kv')
- , text "of kind:" <+> ppr (tyVarKind kv')
- , text "Perhaps enable PolyKinds or add a kind signature" ])
- -- We failed to default it, so return False to say so.
- -- Hence, it'll get skolemised. That might seem odd, but we must either
- -- promote, skolemise, or zap-to-Any, to satisfy GHC.Tc.Gen.HsType
- -- Note [Recipe for checking a signature]
- -- Otherwise we get level-number assertion failures. It doesn't matter much
- -- because we are in an error situation anyway.
- ; return False
- }
- where
- (_, kv') = tidyOpenTyCoVar emptyTidyEnv kv
-- | Default some unconstrained type variables, as specified
-- by the defaulting options:
@@ -1874,13 +1845,9 @@ defaultTyVars :: NonStandardDefaultingStrategy
-> CandidatesQTvs -- ^ all candidates for quantification
-> TcM [TcTyVar] -- ^ those variables not defaulted
defaultTyVars ns_strat dvs
- = do { poly_kinds <- xoptM LangExt.PolyKinds
- ; let
- def_tvs, def_kvs :: DefaultingStrategy
+ = do { let
+ def_tvs :: DefaultingStrategy
def_tvs = NonStandardDefaulting ns_strat
- def_kvs
- | poly_kinds = def_tvs
- | otherwise = DefaultKindVars
-- As -XNoPolyKinds precludes polymorphic kind variables, we default them.
-- For example:
--
@@ -1891,7 +1858,7 @@ defaultTyVars ns_strat dvs
-- Here we get `a :: TYPE r`, so to accept this program when -XNoPolyKinds is enabled
-- we must default the kind variable `r :: RuntimeRep`.
-- Test case: T20584.
- ; defaulted_kvs <- mapM (defaultTyVar def_kvs) dep_kvs
+ ; defaulted_kvs <- mapM (defaultTyVar def_tvs) dep_kvs
; defaulted_tvs <- mapM (defaultTyVar def_tvs) nondep_tvs
; let undefaulted_kvs = [ kv | (kv, False) <- dep_kvs `zip` defaulted_kvs ]
undefaulted_tvs = [ tv | (tv, False) <- nondep_tvs `zip` defaulted_tvs ]
diff --git a/compiler/GHC/Types/Basic.hs b/compiler/GHC/Types/Basic.hs
index c650aed944..413c7d6e2c 100644
--- a/compiler/GHC/Types/Basic.hs
+++ b/compiler/GHC/Types/Basic.hs
@@ -1881,23 +1881,11 @@ data NonStandardDefaultingStrategy
-- | Specify whether to default kind variables, and type variables
-- of kind 'RuntimeRep'/'Levity'/'Multiplicity'.
data DefaultingStrategy
- -- | Default kind variables:
- --
- -- - default kind variables of kind 'Type' to 'Type',
- -- - default 'RuntimeRep'/'Levity'/'Multiplicity' kind variables
- -- to 'LiftedRep'/'Lifted'/'Many', respectively.
- --
- -- When this strategy is used, it means that we have determined that
- -- the variables we are considering defaulting are all kind variables.
- --
- -- Usually, we pass this option when -XNoPolyKinds is enabled.
- = DefaultKindVars
-- | Default (or don't default) non-standard variables, of kinds
-- 'RuntimeRep', 'Levity' and 'Multiplicity'.
- | NonStandardDefaulting NonStandardDefaultingStrategy
+ = NonStandardDefaulting NonStandardDefaultingStrategy
defaultNonStandardTyVars :: DefaultingStrategy -> Bool
-defaultNonStandardTyVars DefaultKindVars = True
defaultNonStandardTyVars (NonStandardDefaulting DefaultNonStandardTyVars) = True
defaultNonStandardTyVars (NonStandardDefaulting TryNotToDefaultNonStandardTyVars) = False
@@ -1906,5 +1894,4 @@ instance Outputable NonStandardDefaultingStrategy where
ppr TryNotToDefaultNonStandardTyVars = text "TryNotToDefaultNonStandardTyVars"
instance Outputable DefaultingStrategy where
- ppr DefaultKindVars = text "DefaultKindVars"
ppr (NonStandardDefaulting ns) = text "NonStandardDefaulting" <+> ppr ns
diff --git a/compiler/GHC/Types/Var.hs-boot b/compiler/GHC/Types/Var.hs-boot
index 1882a86d33..9e30642000 100644
--- a/compiler/GHC/Types/Var.hs-boot
+++ b/compiler/GHC/Types/Var.hs-boot
@@ -1,8 +1,9 @@
-{-# LANGUAGE NoPolyKinds #-}
+{-# LANGUAGE KindSignatures #-}
module GHC.Types.Var where
import GHC.Prelude ()
import {-# SOURCE #-} GHC.Types.Name
+import Data.Kind (Type)
-- We compile this GHC with -XNoImplicitPrelude, so if there are no imports
-- it does not seem to depend on anything. But it does! We must, for
-- example, compile GHC.Types in the ghc-prim library first. So this
@@ -13,7 +14,7 @@ data ArgFlag
data AnonArgFlag
data Var
instance NamedThing Var
-data VarBndr var argf
+data VarBndr (var :: Type) (argf :: Type)
data Specificity
type TyVar = Var
type Id = Var
diff --git a/libraries/base/GHC/Base.hs-boot b/libraries/base/GHC/Base.hs-boot
index 64e6365525..ae9ec85720 100644
--- a/libraries/base/GHC/Base.hs-boot
+++ b/libraries/base/GHC/Base.hs-boot
@@ -1,9 +1,9 @@
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE NoImplicitPrelude, KindSignatures #-}
module GHC.Base (Maybe, Semigroup, Monoid) where
import GHC.Maybe (Maybe)
-import GHC.Types ()
+import GHC.Types (Type)
-class Semigroup a
-class Monoid a
+class Semigroup (a :: Type)
+class Monoid (a :: Type)
diff --git a/libraries/base/GHC/ForeignPtr.hs b/libraries/base/GHC/ForeignPtr.hs
index a7061152dc..5e0dab1acf 100644
--- a/libraries/base/GHC/ForeignPtr.hs
+++ b/libraries/base/GHC/ForeignPtr.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE UnboxedTuples #-}
@@ -63,6 +64,7 @@ import GHC.Base
import GHC.IORef
import GHC.STRef ( STRef(..) )
import GHC.Ptr ( Ptr(..), FunPtr(..) )
+import GHC.Types ( Type )
import Unsafe.Coerce ( unsafeCoerce )
@@ -82,7 +84,7 @@ import Unsafe.Coerce ( unsafeCoerce )
-- type argument of 'ForeignPtr' should normally be an instance of
-- class 'Storable'.
--
-data ForeignPtr a = ForeignPtr Addr# ForeignPtrContents
+data ForeignPtr (a :: Type) = ForeignPtr Addr# ForeignPtrContents
-- The Addr# in the ForeignPtr object is intentionally stored
-- separately from the finalizer. The primary aim of the
-- representation is to make withForeignPtr efficient; in fact,
diff --git a/libraries/base/GHC/Ptr.hs b/libraries/base/GHC/Ptr.hs
index f19e7b90c8..bf7dbbec89 100644
--- a/libraries/base/GHC/Ptr.hs
+++ b/libraries/base/GHC/Ptr.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, RoleAnnotations #-}
+{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE UnboxedTuples #-}
{-# OPTIONS_HADDOCK not-home #-}
@@ -44,7 +45,7 @@ import Numeric ( showHex )
-- redundant role annotation checks that this doesn't change
type role Ptr phantom
-data Ptr a = Ptr Addr#
+data Ptr (a :: Type) = Ptr Addr#
deriving ( Eq -- ^ @since 2.01
, Ord -- ^ @since 2.01
)
@@ -93,7 +94,7 @@ minusPtr (Ptr a1) (Ptr a2) = I# (minusAddr# a1 a2)
-- 'FunPtr' has a phantom role for similar reasons to 'Ptr'.
type role FunPtr phantom
-data FunPtr a = FunPtr Addr# deriving (Eq, Ord)
+data FunPtr (a :: Type) = FunPtr Addr# deriving (Eq, Ord)
-- ^ A value of type @'FunPtr' a@ is a pointer to a function callable
-- from foreign code. The type @a@ will normally be a /foreign type/,
-- a function type with zero or more arguments where
diff --git a/libraries/base/GHC/Real.hs-boot b/libraries/base/GHC/Real.hs-boot
index b462c1c299..7805675e3f 100644
--- a/libraries/base/GHC/Real.hs-boot
+++ b/libraries/base/GHC/Real.hs-boot
@@ -1,7 +1,7 @@
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE NoImplicitPrelude, KindSignatures #-}
module GHC.Real where
-import GHC.Types ()
+import GHC.Types (Type)
-class Integral a
+class Integral (a :: Type)
diff --git a/libraries/ghci/GHCi/RemoteTypes.hs b/libraries/ghci/GHCi/RemoteTypes.hs
index bbd7d32bed..293e4d2a00 100644
--- a/libraries/ghci/GHCi/RemoteTypes.hs
+++ b/libraries/ghci/GHCi/RemoteTypes.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, StandaloneDeriving, GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE CPP, StandaloneDeriving, GeneralizedNewtypeDeriving, KindSignatures #-}
-- |
-- Types for referring to remote objects in Remote GHCi. For more
@@ -26,6 +26,7 @@ import Data.Binary
import Unsafe.Coerce
import GHC.Exts
import GHC.ForeignPtr
+import Data.Kind ( Type )
-- -----------------------------------------------------------------------------
-- RemotePtr
@@ -36,7 +37,7 @@ import GHC.ForeignPtr
-- between machines of different word size. For example, when connecting to
-- an iserv instance on a different architecture with different word size via
-- -fexternal-interpreter.
-newtype RemotePtr a = RemotePtr Word64
+newtype RemotePtr (a :: Type) = RemotePtr Word64
toRemotePtr :: Ptr a -> RemotePtr a
toRemotePtr p = RemotePtr (fromIntegral (ptrToWordPtr p))
@@ -60,7 +61,7 @@ instance Show HValue where
show _ = "<HValue>"
-- | A reference to a remote value. These are allocated and freed explicitly.
-newtype RemoteRef a = RemoteRef (RemotePtr ())
+newtype RemoteRef (a :: Type) = RemoteRef (RemotePtr ())
deriving (Show, Binary)
-- We can discard type information if we want