@@ -57,7 +57,7 @@ data ElabInfo = EInfo { params :: [(Name, PTerm)],
5757 liftname :: Name -> Name,
5858 namespace :: Maybe [String],
5959 elabFC :: Maybe FC,
60− rec_elabDecl :: ElabWhat -> ElabInfo -> PDecl ->
60+ rec_elabDecl :: ElabWhat -> ElabInfo -> PDecl ->
6161 Idris () }
6262
6363toplevel :: ElabInfo
@@ -601,14 +601,18 @@ data PDecl' t
601601 [PDecl' t] -- declarations
602602 -- ^ Type class: arguments are documentation, syntax info, source location, constraints,
603603 -- class name, parameters, method declarations
604− | PInstance SyntaxInfo FC [(Name, t)] -- constraints
605− Name -- class
606− [t] -- parameters
607− t -- full instance type
608− (Maybe Name) -- explicit name
609− [PDecl' t]
610− -- ^ Instance declaration: arguments are syntax info, source location, constraints,
611− -- class name, parameters, full instance type, optional explicit name, and definitions
604+ | PInstance
605+ (Docstring (Either Err PTerm))
606+ SyntaxInfo
607+ FC [(Name, t)] -- constraints
608+ Name -- class
609+ [t] -- parameters
610+ t -- full instance type
611+ (Maybe Name) -- explicit name
612+ [PDecl' t]
613+ -- ^ Instance declaration: documentation, arguments are syntax info, source
614+ -- location, constraints, class name, parameters, full instance
615+ -- type, optional explicit name, and definitions
612616 | PDSL Name (DSL' t) -- ^ DSL declaration
613617 | PSyntax FC Syntax -- ^ Syntax definition
614618 | PMutual FC [PDecl' t] -- ^ Mutual block
@@ -688,7 +692,7 @@ declared (PParams _ _ ds) = concatMap declared ds
688692declared (PNamespace _ ds) = concatMap declared ds
689693declared (PRecord _ _ _ n _ _ _ c _) = [n, c]
690694declared (PClass _ _ _ _ n _ _ ms) = n : concatMap declared ms
691−declared (PInstance _ _ _ _ _ _ _ _) = []
695+declared (PInstance _ _ _ _ _ _ _ _ _) = []
692696declared (PDSL n _) = [n]
693697declared (PSyntax _ _) = []
694698declared (PMutual _ ds) = concatMap declared ds
@@ -707,7 +711,7 @@ tldeclared (PParams _ _ ds) = []
707711tldeclared (PMutual _ ds) = concatMap tldeclared ds
708712tldeclared (PNamespace _ ds) = concatMap tldeclared ds
709713tldeclared (PClass _ _ _ _ n _ _ ms) = concatMap tldeclared ms
710−tldeclared (PInstance _ _ _ _ _ _ _ _) = []
714+tldeclared (PInstance _ _ _ _ _ _ _ _ _) = []
711715tldeclared _ = []
712716
713717defined :: PDecl -> [Name]
@@ -723,7 +727,7 @@ defined (PParams _ _ ds) = concatMap defined ds
723727defined (PNamespace _ ds) = concatMap defined ds
724728defined (PRecord _ _ _ n _ _ _ c _) = [n, c]
725729defined (PClass _ _ _ _ n _ _ ms) = n : concatMap defined ms
726−defined (PInstance _ _ _ _ _ _ _ _) = []
730+defined (PInstance _ _ _ _ _ _ _ _ _) = []
727731defined (PDSL n _) = [n]
728732defined (PSyntax _ _) = []
729733defined (PMutual _ ds) = concatMap defined ds
@@ -778,7 +782,7 @@ data PTerm = PQuote Raw -- ^ Inclusion of a core term into the high-level langua
778782 | PAlternative Bool [PTerm] -- ^ True if only one may work. (| A, B, C|)
779783 | PHidden PTerm -- ^ Irrelevant or hidden pattern
780784 | PType -- ^ 'Type' type
781− | PUniverse Universe -- ^ Some universe
785+ | PUniverse Universe -- ^ Some universe
782786 | PGoal FC PTerm Name PTerm -- ^ quoteGoal, used for %reflection functions
783787 | PConstant Const -- ^ Builtin types
784788 | Placeholder -- ^ Underscore
@@ -1113,7 +1117,7 @@ data SSymbol = Keyword Name
11131117 | Expr Name
11141118 | SimpleExpr Name
11151119 deriving (Show, Eq)
1116−
1120+
11171121
11181122{-!
11191123deriving instance Binary SSymbol
@@ -1388,7 +1392,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
13881392 where
13891393 startPrec = 0
13901394 funcAppPrec = 10
1391−
1395+
13921396 prettySe :: Int -> [(Name, Bool)] -> PTerm -> Doc OutputAnnotation
13931397 prettySe p bnd (PQuote r) =
13941398 text "![" <> pretty r <> text "]"
@@ -1451,7 +1455,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
14511455 [x] -> group (opName True <$> group (prettySe startPrec bnd (getTm x)))
14521456 [l,r] -> let precedence = maybe (startPrec - 1) prec f
14531457 in bracket p precedence $ inFix (getTm l) (getTm r)
1454− (l@(PExp _ _ _ _) : r@(PExp _ _ _ _) : rest) ->
1458+ (l@(PExp _ _ _ _) : r@(PExp _ _ _ _) : rest) ->
14551459 bracket p funcAppPrec $
14561460 enclose lparen rparen (inFix (getTm l) (getTm r)) <+>
14571461 align (group (vsep (map (prettyArgS bnd) rest)))
@@ -1467,7 +1471,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
14671471 Just (Infixr p') -> p'
14681472 Just f' -> prec f' + 1
14691473 inFix l r = align . group $
1470− (prettySe left bnd l <+> opName False) <$>
1474+ (prettySe left bnd l <+> opName False) <$>
14711475 group (prettySe right bnd r)
14721476 prettySe p bnd (PApp _ hd@(PRef fc f) [tm]) -- symbols, like 'foo
14731477 | PConstant (Idris.Core.TT.Str str) <- getTm tm,
@@ -1486,7 +1490,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
14861490 align $ kwd "case" <+> prettySe startPrec bnd scr <+> kwd "of" <$>
14871491 indent 2 (vsep (map ppcase cases))
14881492 where
1489− ppcase (l, r) = let prettyCase = prettySe startPrec
1493+ ppcase (l, r) = let prettyCase = prettySe startPrec
14901494 ([(n, False) | n <- vars l] ++ bnd)
14911495 in nest nestingSize $
14921496 prettyCase l <+> text "=>" <+> prettyCase r
@@ -1557,7 +1561,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
15571561 prettyAs =
15581562 foldr (\l -> \r -> l <+> text "," <+> r) empty $ map (prettySe startPrec bnd) as
15591563 prettySe p bnd PType = annotate (AnnType "Type" "The type of types") $ text "Type"
1560− prettySe p bnd (PUniverse u) = annotate (AnnType (show u) "The type of unique types") $ text (show u)
1564+ prettySe p bnd (PUniverse u) = annotate (AnnType (show u) "The type of unique types") $ text (show u)
15611565 prettySe p bnd (PConstant c) = annotate (AnnConst c) (text (show c))
15621566 -- XXX: add pretty for tactics
15631567 prettySe p bnd (PProof ts) =
@@ -1729,7 +1733,7 @@ showDeclImp o (PNamespace n ps) = text "namespace" <+> text n <> braces (line <>
17291733showDeclImp _ (PSyntax _ syn) = text "syntax" <+> text (show syn)
17301734showDeclImp o (PClass _ _ _ cs n ps _ ds)
17311735 = text "class" <+> text (show cs) <+> text (show n) <+> text (show ps) <> line <> showDecls o ds
1732−showDeclImp o (PInstance _ _ cs n _ t _ ds)
1736+showDeclImp o (PInstance _ _ _ cs n _ t _ ds)
17331737 = text "instance" <+> text (show cs) <+> text (show n) <+> prettyImp o t <> line <> showDecls o ds
17341738showDeclImp _ _ = text "..."
17351739-- showDeclImp (PImport o) = "import " ++ o
@@ -1905,16 +1909,16 @@ implicitNamesIn :: [Name] -> IState -> PTerm -> [Name]
19051909implicitNamesIn uvars ist tm = nub $ ni [] tm
19061910 where
19071911 ni env (PRef _ n)
1908− | not (n `elem` env)
1912+ | not (n `elem` env)
19091913 = case lookupTy n (tt_ctxt ist) of
19101914 [] -> [n]
19111915 _ -> if n `elem` uvars then [n] else []
1912− ni env (PApp _ f@(PRef _ n) as)
1916+ ni env (PApp _ f@(PRef _ n) as)
19131917 | n `elem` uvars = ni env f ++ concatMap (ni env) (map getTm as)
19141918 | otherwise = concatMap (ni env) (map getTm as)
19151919 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
19161920 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1917− ni env (PCase _ c os) = ni env c ++
1921+ ni env (PCase _ c os) = ni env c ++
19181922 -- names in 'os', not counting the names bound in the cases
19191923 (nub (concatMap (ni env) (map snd os))
19201924 \\ nub (concatMap (ni env) (map fst os)))
@@ -1944,7 +1948,7 @@ namesIn uvars ist tm = nub $ ni [] tm
19441948 _ -> if n `elem` (map fst uvars) then [n] else []
19451949 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
19461950 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1947− ni env (PCase _ c os) = ni env c ++
1951+ ni env (PCase _ c os) = ni env c ++
19481952 -- names in 'os', not counting the names bound in the cases
19491953 (nub (concatMap (ni env) (map snd os))
19501954 \\ nub (concatMap (ni env) (map fst os)))
@@ -2003,4 +2007,3 @@ getErasureInfo ist n =
20032007 case lookupCtxtExact n (idris_optimisation ist) of
20042008 Just (Optimise inacc detagg) -> map fst inacc
20052009 Nothing -> []
2006−