Commit aeb4bd95 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Remove typeKind from Type.hs-boot

Simple refactoring, reducing unncessary module loops
parent a211dca8
......@@ -3,7 +3,7 @@
{-# LANGUAGE CPP #-}
module Kind (
-- * Main data type
Kind, typeKind,
Kind,
-- ** Predicates on Kinds
isLiftedTypeKind, isUnliftedTypeKind,
......@@ -20,7 +20,7 @@ module Kind (
#include "HsVersions.h"
import {-# SOURCE #-} Type ( typeKind, coreView, tcView
import {-# SOURCE #-} Type ( coreView, tcView
, splitTyConApp_maybe )
import {-# SOURCE #-} DataCon ( DataCon )
......
......@@ -40,7 +40,6 @@ module TyCoRep (
mkPiTy, mkPiTys,
isLiftedTypeKind, isUnliftedTypeKind,
isCoercionType, isRuntimeRepTy, isRuntimeRepVar,
isRuntimeRepKindedTy, dropRuntimeRepArgs,
sameVis,
-- * Functions over binders
......@@ -141,7 +140,7 @@ import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy, mkCastTy
, tyCoVarsOfTypeWellScoped
, tyCoVarsOfTypesWellScoped
, toposortTyVars
, coreView, typeKind )
, coreView )
-- Transitively pulls in a LOT of stuff, better to break the loop
import {-# SOURCE #-} Coercion
......@@ -736,23 +735,10 @@ isRuntimeRepTy ty | Just ty' <- coreView ty = isRuntimeRepTy ty'
isRuntimeRepTy (TyConApp tc []) = tc `hasKey` runtimeRepTyConKey
isRuntimeRepTy _ = False
-- | Is this a type of kind RuntimeRep? (e.g. LiftedRep)
isRuntimeRepKindedTy :: Type -> Bool
isRuntimeRepKindedTy = isRuntimeRepTy . typeKind
-- | Is a tyvar of type 'RuntimeRep'?
isRuntimeRepVar :: TyVar -> Bool
isRuntimeRepVar = isRuntimeRepTy . tyVarKind
-- | Drops prefix of RuntimeRep constructors in 'TyConApp's. Useful for e.g.
-- dropping 'LiftedRep arguments of unboxed tuple TyCon applications:
--
-- dropRuntimeRepArgs [ 'LiftedRep, 'IntRep
-- , String, Int# ] == [String, Int#]
--
dropRuntimeRepArgs :: [Type] -> [Type]
dropRuntimeRepArgs = dropWhile isRuntimeRepKindedTy
{-
%************************************************************************
%* *
......
......@@ -1956,6 +1956,19 @@ isUnliftedType ty
= not (isLiftedType_maybe ty `orElse`
pprPanic "isUnliftedType" (ppr ty <+> dcolon <+> ppr (typeKind ty)))
-- | Is this a type of kind RuntimeRep? (e.g. LiftedRep)
isRuntimeRepKindedTy :: Type -> Bool
isRuntimeRepKindedTy = isRuntimeRepTy . typeKind
-- | Drops prefix of RuntimeRep constructors in 'TyConApp's. Useful for e.g.
-- dropping 'LiftedRep arguments of unboxed tuple TyCon applications:
--
-- dropRuntimeRepArgs [ 'LiftedRep, 'IntRep
-- , String, Int# ] == [String, Int#]
--
dropRuntimeRepArgs :: [Type] -> [Type]
dropRuntimeRepArgs = dropWhile isRuntimeRepKindedTy
-- | Extract the RuntimeRep classifier of a type. For instance,
-- @getRuntimeRep_maybe Int = LiftedRep@. Returns 'Nothing' if this is not
-- possible.
......
......@@ -3,7 +3,7 @@
module Type where
import TyCon
import Var ( TyCoVar )
import {-# SOURCE #-} TyCoRep( Type, Coercion, Kind )
import {-# SOURCE #-} TyCoRep( Type, Coercion )
import Util
isPredTy :: Type -> Bool
......@@ -13,7 +13,6 @@ mkAppTy :: Type -> Type -> Type
mkCastTy :: Type -> Coercion -> Type
piResultTy :: HasDebugCallStack => Type -> Type -> Type
typeKind :: Type -> Kind
eqType :: Type -> Type -> Bool
partitionInvisibles :: TyCon -> (a -> Type) -> [a] -> ([a], [a])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment