less prototype, less bad code implementation of CCHM type theory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
964 B

  1. module Presyntax.Presyntax where
  2. import Data.Text (Text)
  3. data Plicity
  4. = Im | Ex
  5. deriving (Eq, Show, Ord)
  6. data Expr
  7. = Var Text
  8. | App Plicity Expr Expr
  9. | Pi Plicity Text Expr Expr
  10. | Lam Plicity Text Expr
  11. | Sigma Text Expr Expr
  12. | Pair Expr Expr
  13. | Proj1 Expr
  14. | Proj2 Expr
  15. -- System
  16. | LamSystem [(Condition, Expr)]
  17. | Span Expr Posn Posn
  18. deriving (Eq, Show, Ord)
  19. data Condition
  20. = Condition { condF :: Formula, condV :: Maybe Text }
  21. deriving (Eq, Show, Ord)
  22. data Formula
  23. = FIs1 Text
  24. | FIs0 Text
  25. | FAnd Formula Formula
  26. | FOr Formula Formula
  27. | FTop
  28. | FBot
  29. deriving (Eq, Show, Ord)
  30. data Statement
  31. = Decl [Text] Expr
  32. | Defn Text Expr
  33. | Builtin Text Text
  34. | ReplNf Expr -- REPL eval
  35. | ReplTy Expr -- REPL :t
  36. | SpanSt Statement Posn Posn
  37. deriving (Eq, Show, Ord)
  38. data Posn
  39. = Posn { posnLine :: {-# UNPACK #-} !Int
  40. , posnColm :: {-# UNPACK #-} !Int
  41. }
  42. deriving (Eq, Show, Ord)