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.

57 lines
1023 B

  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. -- System
  18. | LamSystem [(Condition, Expr)]
  19. | Span Expr Posn Posn
  20. deriving (Eq, Show, Ord)
  21. data Condition
  22. = Condition { condF :: Formula, condV :: Maybe Text }
  23. deriving (Eq, Show, Ord)
  24. data Formula
  25. = FIs1 Text
  26. | FIs0 Text
  27. | FAnd Formula Formula
  28. | FOr Formula Formula
  29. | FTop
  30. | FBot
  31. deriving (Eq, Show, Ord)
  32. data Statement
  33. = Decl [Text] Expr
  34. | Defn Text Expr
  35. | Builtin Text Text
  36. | ReplNf Expr -- REPL eval
  37. | ReplTy Expr -- REPL :t
  38. | SpanSt Statement Posn Posn
  39. deriving (Eq, Show, Ord)
  40. data Posn
  41. = Posn { posnLine :: {-# UNPACK #-} !Int
  42. , posnColm :: {-# UNPACK #-} !Int
  43. }
  44. deriving (Eq, Show, Ord)