@@ -357,6 +357,7 @@ data Opt = Filename String
357357 | OutputTy OutputType
358358 | Extension LanguageExt
359359 | InterpretScript String
360+ | EvalExpr String
360361 | TargetTriple String
361362 | TargetCPU String
362363 | OptLevel Word
@@ -986,40 +987,80 @@ primNames = [unitTy, unitCon,
986987 falseTy, pairTy, pairCon,
987988 eqTy, eqCon, inferTy, inferCon]
988989
990+unitDoc = parseDocstring . T.pack $ "The canonical single-element type, also known as the trivially true proposition."
989991unitTy = sMN 0 "__Unit"
990992unitCon = sMN 0 "__II"
991993unitDecl = PDatadecl unitTy PType
992− [(emptyDocstring, [], unitCon, PRef bi unitTy, bi, [])]
994+ [(parseDocstring . T.pack $ "The trivial constructor for `()`. ", [], unitCon, PRef bi unitTy, bi, [])]
993995unitOpts = [DefaultEliminator]
994996
997+falseDoc = parseDocstring . T.pack $
998+ "The empty type, also known as the trivially false proposition." ++
999+ "\n\n" ++
1000+ "Use `FalseElim` or `absurd` to prove anything if you have a variable " ++
1001+ "of type `_|_` in scope."
9951002falseTy = sMN 0 "__False"
9961003falseDecl = PDatadecl falseTy PType []
9971004falseOpts = []
9981005
1006+pairDoc = parseDocstring . T.pack $ "The non-dependent pair type, also known as conjunction."
9991007pairTy = sMN 0 "__Pair"
10001008pairCon = sMN 0 "__MkPair"
10011009pairDecl = PDatadecl pairTy (piBind [(n "A", PType), (n "B", PType)] PType)
1002− [(emptyDocstring, [], pairCon, PPi impl (n "A") PType (
1003− PPi impl (n "B") PType (
1004− PPi expl (n "a") (PRef bi (n "A")) (
1005− PPi expl (n "b") (PRef bi (n "B"))
1006− (PApp bi (PRef bi pairTy) [pexp (PRef bi (n "A")),
1007− pexp (PRef bi (n "B"))])))), bi, [])]
1010+ [(pairConDoc, pairConParamDoc,
1011+ pairCon, PPi impl (n "A") PType (
1012+ PPi impl (n "B") PType (
1013+ PPi expl (n "a") (PRef bi (n "A")) (
1014+ PPi expl (n "b") (PRef bi (n "B"))
1015+ (PApp bi (PRef bi pairTy) [pexp (PRef bi (n "A")),
1016+ pexp (PRef bi (n "B"))])))), bi, [])]
10081017 where n a = sMN 0 a
1018+ pairConDoc = parseDocstring . T.pack $ "A pair of elements"
1019+ pairConParamDoc = [(n "a", parseDocstring . T.pack $ "the left element of the pair"),
1020+ (n "b", parseDocstring . T.pack $ "the right element of the pair")]
10091021pairOpts = []
1022+pairParamDoc = [(n "A", parseDocstring . T.pack $ "the type of the left elements in the pair"),
1023+ (n "B", parseDocstring . T.pack $ "the type of the left elements in the pair")]
1024+ where n a = sMN 0 a
10101025
10111026eqTy = sUN "="
10121027eqCon = sUN "refl"
1028+eqDoc = parseDocstring . T.pack $
1029+ "The propositional equality type. A proof that `x` = `y`." ++
1030+ "\n\n" ++
1031+ "To use such a proof, pattern-match on it, and the two equal things will " ++
1032+ "then need to be the _same_ pattern." ++
1033+ "\n\n" ++
1034+ "**Note**: Idris's equality type is _heterogeneous_, which means that it " ++
1035+ "is possible to state equalities between values of potentially different " ++
1036+ "types. This is sometimes referred to in the literature as \"John Major\" " ++
1037+ "equality." ++
1038+ "\n\n" ++
1039+ "Thus, if Idris can't infer the type of one side of the equality, then " ++
1040+ "you may need to annotate it. See the function `the`."
1041+
10131042eqDecl = PDatadecl eqTy (piBind [(n "A", PType), (n "B", PType),
10141043 (n "x", PRef bi (n "A")), (n "y", PRef bi (n "B"))]
10151044 PType)
1016− [(emptyDocstring, [], eqCon, PPi impl (n "A") PType (
1017− PPi impl (n "x") (PRef bi (n "A"))
1018− (PApp bi (PRef bi eqTy) [pimp (n "A") Placeholder False,
1019− pimp (n "B") Placeholder False,
1020− pexp (PRef bi (n "x")),
1021− pexp (PRef bi (n "x"))])), bi, [])]
1045+ [(reflDoc, reflParamDoc,
1046+ eqCon, PPi impl (n "A") PType (
1047+ PPi impl (n "x") (PRef bi (n "A"))
1048+ (PApp bi (PRef bi eqTy) [pimp (n "A") Placeholder False,
1049+ pimp (n "B") Placeholder False,
1050+ pexp (PRef bi (n "x")),
1051+ pexp (PRef bi (n "x"))])), bi, [])]
10221052 where n a = sMN 0 a
1053+ reflDoc = parseDocstring . T.pack $
1054+ "A proof that `x` in fact equals `x`. To construct this, you must have already " ++
1055+ "shown that both sides are in fact equal."
1056+ reflParamDoc = [(n "A", parseDocstring . T.pack $ "the type at which the equality is proven"),
1057+ (n "x", parseDocstring . T.pack $ "the element shown to be equal to itself.")]
1058+
1059+eqParamDoc = [(n "A", parseDocstring . T.pack $ "the type of the left side of the equality"),
1060+ (n "B", parseDocstring . T.pack $ "the type of the right side of the equality")
1061+ ]
1062+ where n a = sMN 0 a
1063+
10231064eqOpts = []
10241065
10251066elimName = sUN "__Elim"