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.

64 lines
1.2 KiB

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