@@ -357,6 +357,7 @@ data Opt = Filename String
357 | OutputTy OutputType
357 | OutputTy OutputType
358 | Extension LanguageExt
358 | Extension LanguageExt
359 | InterpretScript String
359 | InterpretScript String
360 | TargetTriple String
361 | TargetTriple String
361 | TargetCPU String
362 | TargetCPU String
362 | OptLevel Word
363 | OptLevel Word
@@ -986,40 +987,80 @@ primNames = [unitTy, unitCon,
986 falseTy, pairTy, pairCon,
987 falseTy, pairTy, pairCon,
987 eqTy, eqCon, inferTy, inferCon]
988 eqTy, eqCon, inferTy, inferCon]
990+unitDoc = parseDocstring . T.pack $ "The canonical single-element type, also known as the trivially true proposition."
989unitTy = sMN 0 "__Unit"
991unitTy = sMN 0 "__Unit"
990unitCon = sMN 0 "__II"
992unitCon = sMN 0 "__II"
991unitDecl = PDatadecl unitTy PType
993unitDecl = PDatadecl unitTy PType
992− [(emptyDocstring, [], unitCon, PRef bi unitTy, bi, [])]
994+ [(parseDocstring . T.pack $ "The trivial constructor for `()`. ", [], unitCon, PRef bi unitTy, bi, [])]
993unitOpts = [DefaultEliminator]
995unitOpts = [DefaultEliminator]
997+falseDoc = parseDocstring . T.pack $
998+ "The empty type, also known as the trivially false proposition." ++
1000+ "Use `FalseElim` or `absurd` to prove anything if you have a variable " ++
1001+ "of type `_|_` in scope."
995falseTy = sMN 0 "__False"
1002falseTy = sMN 0 "__False"
996falseDecl = PDatadecl falseTy PType []
1003falseDecl = PDatadecl falseTy PType []
997falseOpts = []
1004falseOpts = []
1006+pairDoc = parseDocstring . T.pack $ "The non-dependent pair type, also known as conjunction."
999pairTy = sMN 0 "__Pair"
1007pairTy = sMN 0 "__Pair"
1000pairCon = sMN 0 "__MkPair"
1008pairCon = sMN 0 "__MkPair"
1001pairDecl = PDatadecl pairTy (piBind [(n "A", PType), (n "B", PType)] PType)
1009pairDecl = PDatadecl pairTy (piBind [(n "A", PType), (n "B", PType)] PType)
1010+ [(pairConDoc, pairConParamDoc,
1002− [(emptyDocstring, [], pairCon, PPi impl (n "A") PType (
1011+ pairCon, PPi impl (n "A") PType (
1003− PPi impl (n "B") PType (
1012+ PPi impl (n "B") PType (
1004− PPi expl (n "a") (PRef bi (n "A")) (
1013+ PPi expl (n "a") (PRef bi (n "A")) (
1005− PPi expl (n "b") (PRef bi (n "B"))
1014+ PPi expl (n "b") (PRef bi (n "B"))
1006− (PApp bi (PRef bi pairTy) [pexp (PRef bi (n "A")),
1015+ (PApp bi (PRef bi pairTy) [pexp (PRef bi (n "A")),
1007− pexp (PRef bi (n "B"))])))), bi, [])]
1016+ pexp (PRef bi (n "B"))])))), bi, [])]
1008 where n a = sMN 0 a
1017 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")]
1009pairOpts = []
1021pairOpts = []
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
1011eqTy = sUN "="
1026eqTy = sUN "="
1012eqCon = sUN "refl"
1027eqCon = sUN "refl"
1028+eqDoc = parseDocstring . T.pack $
1029+ "The propositional equality type. A proof that `x` = `y`." ++
1031+ "To use such a proof, pattern-match on it, and the two equal things will " ++
1032+ "then need to be the _same_ pattern." ++
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\" " ++
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`."
1013eqDecl = PDatadecl eqTy (piBind [(n "A", PType), (n "B", PType),
1042eqDecl = PDatadecl eqTy (piBind [(n "A", PType), (n "B", PType),
1014 (n "x", PRef bi (n "A")), (n "y", PRef bi (n "B"))]
1043 (n "x", PRef bi (n "A")), (n "y", PRef bi (n "B"))]
1045+ [(reflDoc, reflParamDoc,
1016− [(emptyDocstring, [], eqCon, PPi impl (n "A") PType (
1046+ eqCon, PPi impl (n "A") PType (
1017− PPi impl (n "x") (PRef bi (n "A"))
1047+ PPi impl (n "x") (PRef bi (n "A"))
1018− (PApp bi (PRef bi eqTy) [pimp (n "A") Placeholder False,
1048+ (PApp bi (PRef bi eqTy) [pimp (n "A") Placeholder False,
1019− pimp (n "B") Placeholder False,
1049+ pimp (n "B") Placeholder False,
1020− pexp (PRef bi (n "x")),
1050+ pexp (PRef bi (n "x")),
1021− pexp (PRef bi (n "x"))])), bi, [])]
1051+ pexp (PRef bi (n "x"))])), bi, [])]
1022 where n a = sMN 0 a
1052 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.")]
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")
1062+ where n a = sMN 0 a
1023eqOpts = []
1064eqOpts = []
1025elimName = sUN "__Elim"
1066elimName = sUN "__Elim"