module DDC.Type.Check
( Config (..)
, configOfProfile
, checkType
, checkTypeM
, checkSpec
, kindOfSpec
, sortOfKind
, takeSortOfKiCon
, kindOfTwCon
, kindOfTcCon
, Error (..)
, ErrorData (..))
where
import DDC.Type.Check.Judge.Kind
import DDC.Type.Check.Context
import DDC.Type.Check.Error
import DDC.Type.Check.ErrorMessage ()
import DDC.Type.Check.CheckCon
import DDC.Type.Check.Config
import DDC.Type.Universe
import DDC.Type.Exp
import DDC.Base.Pretty
import DDC.Type.Pretty ()
import DDC.Type.Env (KindEnv)
import DDC.Control.Monad.Check (evalCheck)
import qualified DDC.Type.Env as Env
checkType :: (Ord n, Show n, Pretty n)
=> Config n -> KindEnv n -> Universe -> Type n
-> Either (Error n) (Type n, Type n)
checkType config env uni tt
= evalCheck (0, 0)
$ do (t, k, _) <- checkTypeM config env emptyContext
uni tt Recon
return (t, k)
checkSpec :: (Ord n, Show n, Pretty n)
=> Config n -> KindEnv n -> Type n
-> Either (Error n) (Type n, Kind n)
checkSpec config env tt
= evalCheck (0, 0)
$ do (t, k, _) <- checkTypeM config env emptyContext
UniverseSpec tt Recon
return (t, k)
kindOfSpec
:: (Ord n, Show n, Pretty n)
=> Config n -> Type n
-> Either (Error n) (Kind n)
kindOfSpec config tt
= evalCheck (0, 0)
$ do (_, k, _) <- checkTypeM config Env.empty emptyContext
UniverseSpec tt Recon
return k
sortOfKind
:: (Ord n, Show n, Pretty n)
=> Config n -> Kind n
-> Either (Error n) (Sort n)
sortOfKind config tt
= evalCheck (0, 0)
$ do (_, s, _) <- checkTypeM config Env.empty emptyContext
UniverseKind tt Recon
return s