@@ -149,6 +149,9 @@ data PTerm = PQuote Raw
149 | PPi Plicity Name PTerm PTerm
149 | PPi Plicity Name PTerm PTerm
150 | PLet Name PTerm PTerm PTerm -- not implemented yet
150 | PLet Name PTerm PTerm PTerm -- not implemented yet
151 | PApp PTerm [PArg]
151 | PApp PTerm [PArg]
152 | PHidden PTerm -- irrelevant or hidden pattern
155 | PHidden PTerm -- irrelevant or hidden pattern
154 | PConstant Const
157 | PConstant Const
@@ -232,6 +235,9 @@ showImp impl tm = se 10 tm where
232 bracket p 1 $ se 1 f ++ (if impl then concatMap siArg imps else "")
235 bracket p 1 $ se 1 f ++ (if impl then concatMap siArg imps else "")
233 ++ concatMap seArg args
236 ++ concatMap seArg args
234 se p (PHidden tm) = "." ++ se 0 tm
237 se p (PHidden tm) = "." ++ se 0 tm
240+ se p (PPair l r) = "(" ++ se 10 l ++ ", " ++ se 10 r ++ ")"
235 se p PSet = "Set"
241 se p PSet = "Set"
236 se p (PConstant c) = show c
242 se p (PConstant c) = show c
237 se p Placeholder = "_"
243 se p Placeholder = "_"
@@ -288,6 +294,27 @@ getInferTerm tm = error ("getInferTerm " ++ show tm)
288getInferType (Bind n b sc) = Bind n b $ getInferType sc
294getInferType (Bind n b sc) = Bind n b $ getInferType sc
289getInferType (App (App _ ty) _) = ty
295getInferType (App (App _ ty) _) = ty
297+-- Handy primitives: Unit, False, Pair, MkPair
299+unitTy = MN 0 "__Unit"
300+unitCon = MN 0 "__II"
301+unitDecl = PDatadecl unitTy PSet
302+ [(unitCon, PRef unitTy)]
304+falseTy = MN 0 "__False"
305+falseDecl = PDatadecl falseTy PSet []
307+pairTy = MN 0 "__Pair"
308+pairCon = MN 0 "__MkPair"
309+pairDecl = PDatadecl pairTy (piBind [(n "A", PSet), (n "B", PSet)] PSet)
310+ [(pairCon, PPi Imp (n "A") PSet (
311+ PPi Imp (n "B") PSet (
312+ PPi Exp (n "a") (PRef (n "A")) (
313+ PPi Exp (n "b") (PRef (n "B"))
314+ (PApp (PRef pairTy) [PExp (PRef (n "A")),
315+ PExp (PRef (n "B"))])))))]
291piBind :: [(Name, PTerm)] -> PTerm -> PTerm
318piBind :: [(Name, PTerm)] -> PTerm -> PTerm
292piBind [] t = t
319piBind [] t = t
293piBind ((n, ty):ns) t = PPi Exp n ty (piBind ns t)
320piBind ((n, ty):ns) t = PPi Exp n ty (piBind ns t)