on master help sign in
Merge branch 'master' of github.com:idris-lang/Idris-dev
1c93363Edwin Brady
.travis.yml+1−1
@@ -20,7 +20,7 @@ before_script:
20 - tar -xf Idris-dev/dist/idris*.tar.gz
20 - tar -xf Idris-dev/dist/idris*.tar.gz
21 - cd idris*
21 - cd idris*
22script:
22script:
23− - cabal configure -f FFI
23+ - cabal configure -f FFI -f CI
24 - if [[ "$TESTS" != "doc" ]]; then cabal build; fi
24 - if [[ "$TESTS" != "doc" ]]; then cabal build; fi
25 - if [[ "$TESTS" != "doc" ]]; then cabal copy; fi
25 - if [[ "$TESTS" != "doc" ]]; then cabal copy; fi
26 - if [[ "$TESTS" != "doc" ]]; then cabal register; fi
26 - if [[ "$TESTS" != "doc" ]]; then cabal register; fi
Makefile+4
@@ -3,6 +3,10 @@
3include config.mk
3include config.mk
4-include custom.mk
4-include custom.mk
5
5
6+ifdef CI
7+CABALFLAGS += -f CI
8+endif
9+
6install:
10install:
7 $(CABAL) install $(CABALFLAGS)
11 $(CABAL) install $(CABALFLAGS)
8
12
README.md+6
@@ -37,6 +37,12 @@ To build with `libffi` by default, create a `custom.mk` file and add the followi
37
37
38The file custom.mk-alldeps is a suitable example.
38The file custom.mk-alldeps is a suitable example.
39
39
40+The continues integration builds on travis-ci.org are build using the ghc-flag -Werror. To enable this behaviour locally also, please compile using `make CI=true` or adding the following line into `custom.mk`:
41+
42+`CI = true`
43+
44+If you are only compiling for installing the most current version, you can ommit the CI flag, but please make sure you use it if you want to contribute.
45+
40## Code Generation
46## Code Generation
41
47
42Idris has support for external code generators. Supplied with the distribution
48Idris has support for external code generators. Supplied with the distribution
idris.cabal+7
@@ -613,6 +613,11 @@ Flag freestanding
613 Default: False
613 Default: False
614 manual: True
614 manual: True
615
615
616+Flag CI
617+ Description: Built everything using "-Werror", meant for CI-builds only
618+ Default: False
619+ manual: True
620+
616Library
621Library
617 hs-source-dirs: src
622 hs-source-dirs: src
618 Exposed-modules:
623 Exposed-modules:
@@ -791,6 +796,8 @@ Library
791 if flag(freestanding)
796 if flag(freestanding)
792 other-modules: Target_idris
797 other-modules: Target_idris
793 cpp-options: -DFREESTANDING
798 cpp-options: -DFREESTANDING
799+ if flag(CI)
800+ ghc-options: -Werror
794
801
795Executable idris
802Executable idris
796 Main-is: Main.hs
803 Main-is: Main.hs
src/Idris/Apropos.hs+18−4
@@ -1,12 +1,12 @@
1−module Idris.Apropos where
1+module Idris.Apropos (apropos, aproposModules) where
2
2
3import Idris.AbsSyntax
3import Idris.AbsSyntax
4import Idris.Core.Evaluate (ctxtAlist, Def(..))
4import Idris.Core.Evaluate (ctxtAlist, Def(..))
5import Idris.Core.TT (Name(..), Type, TT(..), NameType(..), Binder(..), Const(..),
5import Idris.Core.TT (Name(..), Type, TT(..), NameType(..), Binder(..), Const(..),
6 lookupCtxtExact, toAlist)
6 lookupCtxtExact, toAlist)
7−import Idris.Docstrings (Docstring, containsText)
7+import Idris.Docstrings (Docstring, DocTerm, containsText)
8
8
9−import Data.List (nub)
9+import Data.List (nub, nubBy, intersperse)
10import qualified Data.Text as T
10import qualified Data.Text as T
11
11
12-- | Find definitions that are relevant to all space-delimited components of
12-- | Find definitions that are relevant to all space-delimited components of
@@ -22,11 +22,25 @@ apropos ist what = let defs = ctxtAlist (tt_ctxt ist)
22 docs = toAlist (idris_docstrings ist)
22 docs = toAlist (idris_docstrings ist)
23 in nub (map fst (isAproposAll parts defs) ++
23 in nub (map fst (isAproposAll parts defs) ++
24 map fst (isAproposAll parts docs))
24 map fst (isAproposAll parts docs))
25− where isAproposAll [] xs = xs
25+ where isAproposAll [] xs = xs
26 isAproposAll (what:more) xs = filter (isApropos what)
26 isAproposAll (what:more) xs = filter (isApropos what)
27 (isAproposAll more xs)
27 (isAproposAll more xs)
28 parts = filter ((> 0) . T.length) . T.splitOn (T.pack " ") $ what
28 parts = filter ((> 0) . T.length) . T.splitOn (T.pack " ") $ what
29
29
30+-- | Find modules whose names or docstrings contain all the
31+-- space-delimited components of some string.
32+aproposModules :: IState -> T.Text -> [(String, Docstring DocTerm)]
33+aproposModules ist what = let mods = toAlist (idris_moduledocs ist)
34+ found = nubBy (\x y -> fst x == fst y)
35+ (isAproposAll parts mods)
36+ in map unModName found
37+ where isAproposAll [] xs = xs
38+ isAproposAll (what:more) xs = filter (\(n,d) -> isApropos what n || isApropos what d)
39+ (isAproposAll more xs)
40+ parts = filter ((> 0) . T.length) . T.splitOn (T.pack " ") $ what
41+ unModName (NS _ ns, d) = ((concat . intersperse "." . map T.unpack . reverse) ns, d)
42+ unModName (n, d) = ("<<MODULE>>", d)
43+
30textIn :: T.Text -> T.Text -> Bool
44textIn :: T.Text -> T.Text -> Bool
31textIn a b = T.isInfixOf (T.toLower a) (T.toLower b)
45textIn a b = T.isInfixOf (T.toLower a) (T.toLower b)
32
46
src/Idris/Core/DeepSeq.hs+1−1
@@ -1,4 +1,4 @@
1−{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
1+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
2
2
3module Idris.Core.DeepSeq where
3module Idris.Core.DeepSeq where
4
4
src/Idris/DeepSeq.hs+1−1
@@ -1,4 +1,4 @@
1−{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
1+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
2
2
3module Idris.DeepSeq(module Idris.DeepSeq, module Idris.Core.DeepSeq) where
3module Idris.DeepSeq(module Idris.DeepSeq, module Idris.Core.DeepSeq) where
4
4
src/Idris/Docstrings.hs+1−1
@@ -1,5 +1,5 @@
1{-# LANGUAGE DeriveFunctor, ScopedTypeVariables #-}
1{-# LANGUAGE DeriveFunctor, ScopedTypeVariables #-}
2−{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
2+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
3
3
4-- | Wrapper around Markdown library
4-- | Wrapper around Markdown library
5module Idris.Docstrings (
5module Idris.Docstrings (
src/Idris/Elab/Value.hs+1−1
@@ -1,5 +1,5 @@
1{-# LANGUAGE PatternGuards #-}
1{-# LANGUAGE PatternGuards #-}
2−{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
2+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
3module Idris.Elab.Value(elabVal, elabValBind, elabDocTerms) where
3module Idris.Elab.Value(elabVal, elabValBind, elabDocTerms) where
4
4
5import Idris.AbsSyntax
5import Idris.AbsSyntax
src/Idris/IdeSlave.hs+1−1
@@ -1,4 +1,4 @@
1−{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
1+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
2
2
3{-# LANGUAGE FlexibleInstances, IncoherentInstances, PatternGuards #-}
3{-# LANGUAGE FlexibleInstances, IncoherentInstances, PatternGuards #-}
4
4
src/Idris/Output.hs+1−1
@@ -1,4 +1,4 @@
1−{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
1+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
2
2
3module Idris.Output where
3module Idris.Output where
4
4
src/Idris/REPL.hs+8−3
@@ -5,7 +5,7 @@ module Idris.REPL where
5
5
6import Idris.AbsSyntax
6import Idris.AbsSyntax
7import Idris.ASTUtils
7import Idris.ASTUtils
8−import Idris.Apropos (apropos)
8+import Idris.Apropos (apropos, aproposModules)
9import Idris.REPLParser
9import Idris.REPLParser
10import Idris.ElabDecls
10import Idris.ElabDecls
11import Idris.ElabTerm
11import Idris.ElabTerm
@@ -13,7 +13,7 @@ import Idris.Erasure
13import Idris.Error
13import Idris.Error
14import Idris.ErrReverse
14import Idris.ErrReverse
15import Idris.Delaborate
15import Idris.Delaborate
16−import Idris.Docstrings (Docstring, overview, renderDocstring)
16+import Idris.Docstrings (Docstring, overview, renderDocstring, renderDocTerm)
17import Idris.Help
17import Idris.Help
18import Idris.IdrisDoc
18import Idris.IdrisDoc
19import Idris.Prover
19import Idris.Prover
@@ -1179,16 +1179,21 @@ process fn (Apropos pkgs a) =
1179 iputStrLn $ "Searching packages: " ++ showSep ", " pkgs
1179 iputStrLn $ "Searching packages: " ++ showSep ", " pkgs
1180 mapM_ loadPkgIndex pkgs
1180 mapM_ loadPkgIndex pkgs
1181 ist <- getIState
1181 ist <- getIState
1182+ let mods = aproposModules ist (T.pack a)
1182 let names = apropos ist (T.pack a)
1183 let names = apropos ist (T.pack a)
1183 let aproposInfo = [ (n,
1184 let aproposInfo = [ (n,
1184 delabTy ist n,
1185 delabTy ist n,
1185 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
1186 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
1186 | n <- sort names, isUN n ]
1187 | n <- sort names, isUN n ]
1188+ iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1189+ ppD ist d <> line) mods) <$>
1187− iRenderResult $ vsep (map (prettyDocumentedIst ist) aproposInfo)
1190+ vsep (map (prettyDocumentedIst ist) aproposInfo)
1188 putIState orig
1191 putIState orig
1189 where isUN (UN _) = True
1192 where isUN (UN _) = True
1190 isUN (NS n _) = isUN n
1193 isUN (NS n _) = isUN n
1191 isUN _ = False
1194 isUN _ = False
1195+ ppD ist = renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) []))
1196+
1192
1197
1193process fn (WhoCalls n) =
1198process fn (WhoCalls n) =
1194 do calls <- whoCalls n
1199 do calls <- whoCalls n