Skip to content

Commit

Permalink
[ #7 ] Add type
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Nov 27, 2018
1 parent 0122b7c commit 0394c80
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/full/OwO/Syntax/Abstract.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ type DataPragmas = [DataPragma]
-- | Top-level declarations
-- TODOs: PsiCodata, PsiPattern, PsiCopattern
data PsiDeclaration' t c
= PsiFixity PsiFixityInfo [c]
-- ^ infix, infixl, infixr
= PsiFixity PsiFixityInfo Int [c]
-- ^ (infix, infixl, infixr), priority, symbols
| PsiType c FnPragmas (t c)
-- ^ Type signature
| PsiSubmodule QModuleName [PsiDeclaration' t c]
Expand Down
8 changes: 5 additions & 3 deletions src/full/OwO/TypeChecking.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ typeCheck :: TCEnv -> PsiTerm -> Either TCErr Term
typeCheck env term = return __TODO__

typeCheckFile :: TCState -> PsiFile -> TCM ()
typeCheckFile state file@(PsiFile _ moduleName decls) = do
let typeSignatures = catMaybes $ decls <&> \case
PsiType name pragmas t -> Just (name, pragmas, t)
typeCheckFile state file = do
let decls = declarations file
let moduleName = topLevelModuleName file
let signatures = catMaybes $ decls <&> \case
PsiType name pragmas t -> Just (name, (pragmas, t))
_ -> Nothing
-- TODO:
-- Look for definitions, give warnings about unimplemented definitions
Expand Down
12 changes: 12 additions & 0 deletions src/full/OwO/TypeChecking/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ module OwO.TypeChecking.Core
, ULevel(..)
, BinderInfo(..)
, ConstInfo(..)

, Term'(..)
, Term
, Type
, typeUniverseOfLevel
, typeUniverseModule

, Definition(..)
) where

Expand Down Expand Up @@ -92,3 +96,11 @@ data Definition
= SimpleDefinition !Type !Term
-- ^ No type signature, just an expression with (optional) type specified
deriving (Eq, Generic, Ord, Show)

-- | Built-in definition: Type0, Type1, etc
typeUniverseOfLevel :: Int -> Definition
typeUniverseOfLevel i = SimpleDefinition (TType $ ULevelLit $ succ i) (TType $ ULevelLit i)

-- | Module name for type universes. Like a placeholder
typeUniverseModule :: QModuleName
typeUniverseModule = QModuleName ["OwO", "Primitive"]

0 comments on commit 0394c80

Please sign in to comment.