mutual 937 B

123456789101112131415161718192021222324252627282930313233
  1. Thoughts on mutual declarations
  2. -------------------------------
  3. When checking block of mutual declarations
  4. x1 : A1
  5. x1 = e1
  6. ...
  7. xn : An
  8. xn = en
  9. you first check that (x1:A1)..(xn:An) is a well-formed context and then you
  10. check that e1..en fits this context. Basically we decouple the types from the
  11. definitions.
  12. How can we extend this to datatypes and definitions by pattern matching? What
  13. would the ei's be? An attempt:
  14. data Declaration = ... | Definition Telescope [Definition]
  15. data Definition = FunDef DefInfo Name [Clause]
  16. | DataDef DefInfo [LamBinding] [Constructor]
  17. -- ^ domain-free bindings matching the telescope
  18. I don't see a problem with this approach. Let's try it and see how far we get...
  19. Untyped definitions doesn't fit this.. but they shouldn't appear in a mutual
  20. anyway so let's make a special case for those:
  21. data Declaration = ... | UntypedDefinition DefInfo Name Expr [Declaration]