mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 20:51:43 +03:00
commit
1d078f7888
@ -1,6 +1,6 @@
|
|||||||
module Data.Fin
|
module Data.Fin
|
||||||
|
|
||||||
import Data.Maybe
|
import public Data.Maybe
|
||||||
import Data.Nat
|
import Data.Nat
|
||||||
import Decidable.Equality
|
import Decidable.Equality
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ module Data.List.Views
|
|||||||
|
|
||||||
import Control.WellFounded
|
import Control.WellFounded
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.Nat
|
||||||
import Data.Nat.Views
|
import Data.Nat.Views
|
||||||
|
|
||||||
lengthSuc : (xs : List a) -> (y : a) -> (ys : List a) ->
|
lengthSuc : (xs : List a) -> (y : a) -> (ys : List a) ->
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
module Data.Nat.Views
|
module Data.Nat.Views
|
||||||
|
|
||||||
import Control.WellFounded
|
import Control.WellFounded
|
||||||
|
import Data.Nat
|
||||||
|
|
||||||
||| View for dividing a Nat in half
|
||| View for dividing a Nat in half
|
||||||
public export
|
public export
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module System
|
module System
|
||||||
|
|
||||||
import Data.So
|
import public Data.So
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
module Data.String.Extra
|
module Data.String.Extra
|
||||||
|
|
||||||
|
import Data.List
|
||||||
|
import Data.Nat
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
|
|
||||||
%default total
|
%default total
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module Language.JSON.String.Lexer
|
module Language.JSON.String.Lexer
|
||||||
|
|
||||||
|
import Data.Nat
|
||||||
import Language.JSON.String.Tokens
|
import Language.JSON.String.Tokens
|
||||||
import Text.Lexer
|
import Text.Lexer
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
module System.Path
|
module System.Path
|
||||||
|
|
||||||
|
import Control.Delayed
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Data.Nat
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import Data.String.Extra
|
import Data.String.Extra
|
||||||
import System.Info
|
import System.Info
|
||||||
|
@ -17,7 +17,10 @@ import Data.Maybe
|
|||||||
import Data.NameMap
|
import Data.NameMap
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import Data.Vect
|
import Data.Vect
|
||||||
|
|
||||||
import System
|
import System
|
||||||
|
import System.Directory
|
||||||
|
import System.File
|
||||||
import System.Info
|
import System.Info
|
||||||
|
|
||||||
%default covering
|
%default covering
|
||||||
|
@ -17,7 +17,10 @@ import Data.Maybe
|
|||||||
import Data.NameMap
|
import Data.NameMap
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import Data.Vect
|
import Data.Vect
|
||||||
|
|
||||||
import System
|
import System
|
||||||
|
import System.Directory
|
||||||
|
import System.File
|
||||||
import System.Info
|
import System.Info
|
||||||
|
|
||||||
%default covering
|
%default covering
|
||||||
|
@ -18,7 +18,10 @@ import Data.NameMap
|
|||||||
import Data.Nat
|
import Data.Nat
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import Data.Vect
|
import Data.Vect
|
||||||
|
|
||||||
import System
|
import System
|
||||||
|
import System.Directory
|
||||||
|
import System.File
|
||||||
import System.Info
|
import System.Info
|
||||||
|
|
||||||
%default covering
|
%default covering
|
||||||
|
@ -13,6 +13,8 @@ import Data.IntMap
|
|||||||
import Data.List
|
import Data.List
|
||||||
import Data.NameMap
|
import Data.NameMap
|
||||||
|
|
||||||
|
import System.File
|
||||||
|
|
||||||
-- Reading and writing 'Defs' from/to a binary file
|
-- Reading and writing 'Defs' from/to a binary file
|
||||||
-- In order to be saved, a name must have been flagged using 'toSave'.
|
-- In order to be saved, a name must have been flagged using 'toSave'.
|
||||||
-- (Otherwise we'd save out everything, not just the things in the current
|
-- (Otherwise we'd save out everything, not just the things in the current
|
||||||
@ -322,7 +324,11 @@ addTypeHint fc (tyn, hintn, d)
|
|||||||
|
|
||||||
addAutoHint : {auto c : Ref Ctxt Defs} ->
|
addAutoHint : {auto c : Ref Ctxt Defs} ->
|
||||||
(Name, Bool) -> Core ()
|
(Name, Bool) -> Core ()
|
||||||
addAutoHint (hintn, d) = addGlobalHint hintn d
|
addAutoHint (hintn_in, d)
|
||||||
|
= do defs <- get Ctxt
|
||||||
|
hintn <- toResolvedNames hintn_in
|
||||||
|
|
||||||
|
put Ctxt (record { autoHints $= insert hintn d } defs)
|
||||||
|
|
||||||
export
|
export
|
||||||
updatePair : {auto c : Ref Ctxt Defs} ->
|
updatePair : {auto c : Ref Ctxt Defs} ->
|
||||||
@ -400,13 +406,15 @@ export
|
|||||||
readFromTTC : TTC extra =>
|
readFromTTC : TTC extra =>
|
||||||
{auto c : Ref Ctxt Defs} ->
|
{auto c : Ref Ctxt Defs} ->
|
||||||
{auto u : Ref UST UState} ->
|
{auto u : Ref UST UState} ->
|
||||||
FC -> Bool ->
|
Bool -> -- set nested namespaces (for records, to use at the REPL)
|
||||||
|
FC ->
|
||||||
|
Bool -> -- importing as public
|
||||||
(fname : String) -> -- file containing the module
|
(fname : String) -> -- file containing the module
|
||||||
(modNS : List String) -> -- module namespace
|
(modNS : List String) -> -- module namespace
|
||||||
(importAs : List String) -> -- namespace to import as
|
(importAs : List String) -> -- namespace to import as
|
||||||
Core (Maybe (extra, Int,
|
Core (Maybe (extra, Int,
|
||||||
List (List String, Bool, List String)))
|
List (List String, Bool, List String)))
|
||||||
readFromTTC loc reexp fname modNS importAs
|
readFromTTC nestedns loc reexp fname modNS importAs
|
||||||
= do defs <- get Ctxt
|
= do defs <- get Ctxt
|
||||||
-- If it's already in the context, with the same visibility flag,
|
-- If it's already in the context, with the same visibility flag,
|
||||||
-- don't load it again (we do need to load it again if it's visible
|
-- don't load it again (we do need to load it again if it's visible
|
||||||
@ -434,7 +442,7 @@ readFromTTC loc reexp fname modNS importAs
|
|||||||
traverse (addGlobalDef modNS as) (context ttc)
|
traverse (addGlobalDef modNS as) (context ttc)
|
||||||
traverse_ addUserHole (userHoles ttc)
|
traverse_ addUserHole (userHoles ttc)
|
||||||
setNS (currentNS ttc)
|
setNS (currentNS ttc)
|
||||||
setNestedNS (nestedNS ttc)
|
when nestedns $ setNestedNS (nestedNS ttc)
|
||||||
-- Set up typeHints and autoHints based on the loaded data
|
-- Set up typeHints and autoHints based on the loaded data
|
||||||
traverse_ (addTypeHint loc) (typeHints ttc)
|
traverse_ (addTypeHint loc) (typeHints ttc)
|
||||||
traverse_ addAutoHint (autoHints ttc)
|
traverse_ addAutoHint (autoHints ttc)
|
||||||
|
@ -8,6 +8,7 @@ import Parser.Source
|
|||||||
|
|
||||||
import public Data.IORef
|
import public Data.IORef
|
||||||
import System
|
import System
|
||||||
|
import System.File
|
||||||
|
|
||||||
%default covering
|
%default covering
|
||||||
|
|
||||||
|
@ -330,6 +330,13 @@ mutual
|
|||||||
pure (App fc f' aerased,
|
pure (App fc f' aerased,
|
||||||
glueBack defs env sc',
|
glueBack defs env sc',
|
||||||
fused ++ aused)
|
fused ++ aused)
|
||||||
|
NApp _ (NRef _ n) _ =>
|
||||||
|
do Just _ <- lookupCtxtExact n (gamma defs)
|
||||||
|
| _ => throw (UndefinedName fc n)
|
||||||
|
tfty <- getTerm gfty
|
||||||
|
throw (GenericMsg fc ("Linearity checking failed on " ++ show f' ++
|
||||||
|
" (" ++ show tfty ++ " not a function type)"))
|
||||||
|
|
||||||
_ => do tfty <- getTerm gfty
|
_ => do tfty <- getTerm gfty
|
||||||
throw (GenericMsg fc ("Linearity checking failed on " ++ show f' ++
|
throw (GenericMsg fc ("Linearity checking failed on " ++ show f' ++
|
||||||
" (" ++ show tfty ++ " not a function type)"))
|
" (" ++ show tfty ++ " not a function type)"))
|
||||||
@ -567,14 +574,14 @@ mutual
|
|||||||
lcheckDef fc rig True env n
|
lcheckDef fc rig True env n
|
||||||
= do defs <- get Ctxt
|
= do defs <- get Ctxt
|
||||||
Just def <- lookupCtxtExact n (gamma defs)
|
Just def <- lookupCtxtExact n (gamma defs)
|
||||||
| Nothing => throw (InternalError ("Linearity checking failed on " ++ show n))
|
| Nothing => throw (UndefinedName fc n)
|
||||||
pure (type def)
|
pure (type def)
|
||||||
lcheckDef fc rig False env n
|
lcheckDef fc rig False env n
|
||||||
= do defs <- get Ctxt
|
= do defs <- get Ctxt
|
||||||
let Just idx = getNameID n (gamma defs)
|
let Just idx = getNameID n (gamma defs)
|
||||||
| Nothing => throw (InternalError ("Linearity checking failed on " ++ show n))
|
| Nothing => throw (UndefinedName fc n)
|
||||||
Just def <- lookupCtxtExact (Resolved idx) (gamma defs)
|
Just def <- lookupCtxtExact (Resolved idx) (gamma defs)
|
||||||
| Nothing => throw (InternalError ("Linearity checking failed on " ++ show n))
|
| Nothing => throw (UndefinedName fc n)
|
||||||
rigSafe (multiplicity def) rig
|
rigSafe (multiplicity def) rig
|
||||||
if linearChecked def
|
if linearChecked def
|
||||||
then pure (type def)
|
then pure (type def)
|
||||||
|
@ -13,6 +13,8 @@ import Data.List
|
|||||||
|
|
||||||
import Utils.Binary
|
import Utils.Binary
|
||||||
|
|
||||||
|
import System.File
|
||||||
|
|
||||||
-- Additional data we keep about the context to support interactive editing
|
-- Additional data we keep about the context to support interactive editing
|
||||||
|
|
||||||
public export
|
public export
|
||||||
|
@ -788,7 +788,7 @@ export
|
|||||||
TTC Def where
|
TTC Def where
|
||||||
toBuf b None = tag 0
|
toBuf b None = tag 0
|
||||||
toBuf b (PMDef pi args ct rt pats)
|
toBuf b (PMDef pi args ct rt pats)
|
||||||
= do tag 1; toBuf b pi; toBuf b args; toBuf b ct; toBuf b rt; toBuf b pats
|
= do tag 1; toBuf b pi; toBuf b args; toBuf b ct; toBuf b pats
|
||||||
toBuf b (ExternDef a)
|
toBuf b (ExternDef a)
|
||||||
= do tag 2; toBuf b a
|
= do tag 2; toBuf b a
|
||||||
toBuf b (ForeignDef a cs)
|
toBuf b (ForeignDef a cs)
|
||||||
@ -815,9 +815,8 @@ TTC Def where
|
|||||||
1 => do pi <- fromBuf b
|
1 => do pi <- fromBuf b
|
||||||
args <- fromBuf b
|
args <- fromBuf b
|
||||||
ct <- fromBuf b
|
ct <- fromBuf b
|
||||||
rt <- fromBuf b
|
|
||||||
pats <- fromBuf b
|
pats <- fromBuf b
|
||||||
pure (PMDef pi args ct rt pats)
|
pure (PMDef pi args ct (Unmatched "") pats)
|
||||||
2 => do a <- fromBuf b
|
2 => do a <- fromBuf b
|
||||||
pure (ExternDef a)
|
pure (ExternDef a)
|
||||||
3 => do a <- fromBuf b
|
3 => do a <- fromBuf b
|
||||||
|
@ -230,6 +230,11 @@ postpone blockedMetas loc mode logstr env x y
|
|||||||
yq <- quote defs env y
|
yq <- quote defs env y
|
||||||
pure (logstr ++ ": " ++ show !(toFullNames xq) ++
|
pure (logstr ++ ": " ++ show !(toFullNames xq) ++
|
||||||
" =?= " ++ show !(toFullNames yq))
|
" =?= " ++ show !(toFullNames yq))
|
||||||
|
|
||||||
|
-- If we're blocked because a name is undefined, give up
|
||||||
|
checkDefined defs x
|
||||||
|
checkDefined defs y
|
||||||
|
|
||||||
xtm <- quote empty env x
|
xtm <- quote empty env x
|
||||||
ytm <- quote empty env y
|
ytm <- quote empty env y
|
||||||
-- Need to find all the metas in the constraint since solving any one
|
-- Need to find all the metas in the constraint since solving any one
|
||||||
@ -249,6 +254,13 @@ postpone blockedMetas loc mode logstr env x y
|
|||||||
logTerm 10 "Y" ytm
|
logTerm 10 "Y" ytm
|
||||||
pure (constrain c)
|
pure (constrain c)
|
||||||
where
|
where
|
||||||
|
checkDefined : Defs -> NF vars -> Core ()
|
||||||
|
checkDefined defs (NApp _ (NRef _ n) _)
|
||||||
|
= do Just _ <- lookupCtxtExact n (gamma defs)
|
||||||
|
| _ => throw (UndefinedName loc n)
|
||||||
|
pure ()
|
||||||
|
checkDefined _ _ = pure ()
|
||||||
|
|
||||||
undefinedN : Name -> Core Bool
|
undefinedN : Name -> Core Bool
|
||||||
undefinedN n
|
undefinedN n
|
||||||
= do defs <- get Ctxt
|
= do defs <- get Ctxt
|
||||||
@ -567,11 +579,11 @@ solveIfUndefined env metavar soln
|
|||||||
= pure False
|
= pure False
|
||||||
|
|
||||||
isDefInvertible : {auto c : Ref Ctxt Defs} ->
|
isDefInvertible : {auto c : Ref Ctxt Defs} ->
|
||||||
Int -> Core Bool
|
FC -> Int -> Core Bool
|
||||||
isDefInvertible i
|
isDefInvertible fc i
|
||||||
= do defs <- get Ctxt
|
= do defs <- get Ctxt
|
||||||
Just gdef <- lookupCtxtExact (Resolved i) (gamma defs)
|
Just gdef <- lookupCtxtExact (Resolved i) (gamma defs)
|
||||||
| Nothing => pure False
|
| Nothing => throw (UndefinedName fc (Resolved i))
|
||||||
pure (invertible gdef)
|
pure (invertible gdef)
|
||||||
|
|
||||||
mutual
|
mutual
|
||||||
@ -906,7 +918,7 @@ mutual
|
|||||||
(NApp yfc (NLocal yr y yp) yargs)
|
(NApp yfc (NLocal yr y yp) yargs)
|
||||||
-- If they're both holes, solve the one with the bigger context
|
-- If they're both holes, solve the one with the bigger context
|
||||||
unifyBothApps mode loc env xfc (NMeta xn xi xargs) xargs' yfc (NMeta yn yi yargs) yargs'
|
unifyBothApps mode loc env xfc (NMeta xn xi xargs) xargs' yfc (NMeta yn yi yargs) yargs'
|
||||||
= do invx <- isDefInvertible xi
|
= do invx <- isDefInvertible loc xi
|
||||||
if xi == yi && (invx || umode mode == InSearch)
|
if xi == yi && (invx || umode mode == InSearch)
|
||||||
-- Invertible, (from auto implicit search)
|
-- Invertible, (from auto implicit search)
|
||||||
-- so we can also unify the arguments.
|
-- so we can also unify the arguments.
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
module Data.ANameMap
|
module Data.ANameMap
|
||||||
|
|
||||||
import Core.Name
|
import Core.Name
|
||||||
|
|
||||||
|
import Data.List
|
||||||
import Data.NameMap
|
import Data.NameMap
|
||||||
import Data.StringMap
|
import Data.StringMap
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import Idris.Syntax
|
|||||||
import Parser.Source
|
import Parser.Source
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import System.File
|
||||||
|
|
||||||
%default covering
|
%default covering
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ import Core.Options
|
|||||||
import Core.TT
|
import Core.TT
|
||||||
import Core.Unify
|
import Core.Unify
|
||||||
|
|
||||||
|
import Data.So
|
||||||
|
|
||||||
import Idris.Desugar
|
import Idris.Desugar
|
||||||
import Idris.Error
|
import Idris.Error
|
||||||
import Idris.ModTree
|
import Idris.ModTree
|
||||||
@ -24,8 +26,9 @@ import Idris.REPL
|
|||||||
import Idris.Syntax
|
import Idris.Syntax
|
||||||
import Idris.Version
|
import Idris.Version
|
||||||
|
|
||||||
import Idris.IDEMode.Parser
|
|
||||||
import Idris.IDEMode.Commands
|
import Idris.IDEMode.Commands
|
||||||
|
import Idris.IDEMode.Holes
|
||||||
|
import Idris.IDEMode.Parser
|
||||||
import Idris.IDEMode.SyntaxHighlight
|
import Idris.IDEMode.SyntaxHighlight
|
||||||
|
|
||||||
import TTImp.Interactive.CaseSplit
|
import TTImp.Interactive.CaseSplit
|
||||||
@ -37,6 +40,7 @@ import Utils.Hex
|
|||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import System
|
import System
|
||||||
|
import System.File
|
||||||
|
|
||||||
import Network.Socket
|
import Network.Socket
|
||||||
import Network.Socket.Data
|
import Network.Socket.Data
|
||||||
|
@ -22,9 +22,12 @@ import Idris.Syntax
|
|||||||
import Idris.Version
|
import Idris.Version
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.So
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import Data.Vect
|
import Data.Vect
|
||||||
import System
|
import System
|
||||||
|
import System.Directory
|
||||||
|
import System.File
|
||||||
|
|
||||||
import Yaffle.Main
|
import Yaffle.Main
|
||||||
|
|
||||||
@ -171,7 +174,7 @@ stMain opts
|
|||||||
the (Core ()) $ case fname of
|
the (Core ()) $ case fname of
|
||||||
Nothing => logTime "Loading prelude" $
|
Nothing => logTime "Loading prelude" $
|
||||||
when (not $ noprelude session) $
|
when (not $ noprelude session) $
|
||||||
readPrelude
|
readPrelude True
|
||||||
Just f => logTime "Loading main file" $
|
Just f => logTime "Loading main file" $
|
||||||
(loadMainFile f >>= displayErrors)
|
(loadMainFile f >>= displayErrors)
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import Core.Unify
|
|||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Data.So
|
||||||
import Data.StringMap
|
import Data.StringMap
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import Data.StringTrie
|
import Data.StringTrie
|
||||||
@ -18,6 +19,9 @@ import Data.These
|
|||||||
|
|
||||||
import Parser.Package
|
import Parser.Package
|
||||||
import System
|
import System
|
||||||
|
import System.Directory
|
||||||
|
import System.File
|
||||||
|
|
||||||
import Text.Parser
|
import Text.Parser
|
||||||
import Utils.Binary
|
import Utils.Binary
|
||||||
import Utils.String
|
import Utils.String
|
||||||
|
@ -57,20 +57,20 @@ processDecls decls
|
|||||||
readModule : {auto c : Ref Ctxt Defs} ->
|
readModule : {auto c : Ref Ctxt Defs} ->
|
||||||
{auto u : Ref UST UState} ->
|
{auto u : Ref UST UState} ->
|
||||||
{auto s : Ref Syn SyntaxInfo} ->
|
{auto s : Ref Syn SyntaxInfo} ->
|
||||||
(top : Bool) ->
|
(full : Bool) -> -- load everything transitively (needed for REPL and compiling)
|
||||||
FC ->
|
FC ->
|
||||||
(visible : Bool) -> -- Is import visible to top level module?
|
(visible : Bool) -> -- Is import visible to top level module?
|
||||||
(reexp : Bool) -> -- Should the module be reexported?
|
(reexp : Bool) -> -- Should the module be reexported?
|
||||||
(imp : List String) -> -- Module name to import
|
(imp : List String) -> -- Module name to import
|
||||||
(as : List String) -> -- Namespace to import into
|
(as : List String) -> -- Namespace to import into
|
||||||
Core ()
|
Core ()
|
||||||
readModule top loc vis reexp imp as
|
readModule full loc vis reexp imp as
|
||||||
= do defs <- get Ctxt
|
= do defs <- get Ctxt
|
||||||
let False = (imp, vis, as) `elem` map snd (allImported defs)
|
let False = (imp, vis, as) `elem` map snd (allImported defs)
|
||||||
| True => when vis (setVisible imp)
|
| True => when vis (setVisible imp)
|
||||||
Right fname <- nsToPath loc imp
|
Right fname <- nsToPath loc imp
|
||||||
| Left err => throw err
|
| Left err => throw err
|
||||||
Just (syn, hash, more) <- readFromTTC {extra = SyntaxInfo}
|
Just (syn, hash, more) <- readFromTTC False {extra = SyntaxInfo}
|
||||||
loc vis fname imp as
|
loc vis fname imp as
|
||||||
| Nothing => when vis (setVisible imp) -- already loaded, just set visibility
|
| Nothing => when vis (setVisible imp) -- already loaded, just set visibility
|
||||||
extendAs imp as syn
|
extendAs imp as syn
|
||||||
@ -82,15 +82,15 @@ readModule top loc vis reexp imp as
|
|||||||
do let m = fst mimp
|
do let m = fst mimp
|
||||||
let reexp = fst (snd mimp)
|
let reexp = fst (snd mimp)
|
||||||
let as = snd (snd mimp)
|
let as = snd (snd mimp)
|
||||||
readModule False loc (vis && reexp) reexp m as) more
|
when (reexp || full) $ readModule full loc (vis && reexp) reexp m as) more
|
||||||
setNS modNS
|
setNS modNS
|
||||||
|
|
||||||
readImport : {auto c : Ref Ctxt Defs} ->
|
readImport : {auto c : Ref Ctxt Defs} ->
|
||||||
{auto u : Ref UST UState} ->
|
{auto u : Ref UST UState} ->
|
||||||
{auto s : Ref Syn SyntaxInfo} ->
|
{auto s : Ref Syn SyntaxInfo} ->
|
||||||
Import -> Core ()
|
Bool -> Import -> Core ()
|
||||||
readImport imp
|
readImport full imp
|
||||||
= do readModule True (loc imp) True (reexport imp) (path imp) (nameAs imp)
|
= do readModule full (loc imp) True (reexport imp) (path imp) (nameAs imp)
|
||||||
addImported (path imp, reexport imp, nameAs imp)
|
addImported (path imp, reexport imp, nameAs imp)
|
||||||
|
|
||||||
readHash : {auto c : Ref Ctxt Defs} ->
|
readHash : {auto c : Ref Ctxt Defs} ->
|
||||||
@ -115,9 +115,10 @@ export
|
|||||||
readPrelude : {auto c : Ref Ctxt Defs} ->
|
readPrelude : {auto c : Ref Ctxt Defs} ->
|
||||||
{auto u : Ref UST UState} ->
|
{auto u : Ref UST UState} ->
|
||||||
{auto s : Ref Syn SyntaxInfo} ->
|
{auto s : Ref Syn SyntaxInfo} ->
|
||||||
Core ()
|
Bool -> Core ()
|
||||||
readPrelude = do readImport prelude
|
readPrelude full
|
||||||
setNS ["Main"]
|
= do readImport full prelude
|
||||||
|
setNS ["Main"]
|
||||||
|
|
||||||
-- Import a TTC for use as the main file (e.g. at the REPL)
|
-- Import a TTC for use as the main file (e.g. at the REPL)
|
||||||
export
|
export
|
||||||
@ -127,7 +128,7 @@ readAsMain : {auto c : Ref Ctxt Defs} ->
|
|||||||
(fname : String) -> Core ()
|
(fname : String) -> Core ()
|
||||||
readAsMain fname
|
readAsMain fname
|
||||||
= do Just (syn, _, more) <- readFromTTC {extra = SyntaxInfo}
|
= do Just (syn, _, more) <- readFromTTC {extra = SyntaxInfo}
|
||||||
toplevelFC True fname [] []
|
True toplevelFC True fname [] []
|
||||||
| Nothing => throw (InternalError "Already loaded")
|
| Nothing => throw (InternalError "Already loaded")
|
||||||
replNS <- getNS
|
replNS <- getNS
|
||||||
replNestedNS <- getNestedNS
|
replNestedNS <- getNestedNS
|
||||||
@ -139,13 +140,13 @@ readAsMain fname
|
|||||||
traverse_ (\ mimp =>
|
traverse_ (\ mimp =>
|
||||||
do let m = fst mimp
|
do let m = fst mimp
|
||||||
let as = snd (snd mimp)
|
let as = snd (snd mimp)
|
||||||
readModule False emptyFC True True m as
|
readModule True emptyFC True True m as
|
||||||
addImported (m, True, as)) more
|
addImported (m, True, as)) more
|
||||||
|
|
||||||
-- also load the prelude, if required, so that we have access to it
|
-- also load the prelude, if required, so that we have access to it
|
||||||
-- at the REPL.
|
-- at the REPL.
|
||||||
when (not (noprelude !getSession)) $
|
when (not (noprelude !getSession)) $
|
||||||
readModule False emptyFC True True ["Prelude"] ["Prelude"]
|
readModule True emptyFC True True ["Prelude"] ["Prelude"]
|
||||||
|
|
||||||
-- We're in the namespace from the first TTC, so use the next name
|
-- We're in the namespace from the first TTC, so use the next name
|
||||||
-- from that for the fresh metavariable name generation
|
-- from that for the fresh metavariable name generation
|
||||||
@ -271,7 +272,7 @@ processMod srcf ttcf msg sourcecode
|
|||||||
-- (also that we only build child dependencies if rebuilding
|
-- (also that we only build child dependencies if rebuilding
|
||||||
-- changes the interface - will need to store a hash in .ttc!)
|
-- changes the interface - will need to store a hash in .ttc!)
|
||||||
logTime "Reading imports" $
|
logTime "Reading imports" $
|
||||||
traverse_ readImport imps
|
traverse_ (readImport False) imps
|
||||||
|
|
||||||
-- Before we process the source, make sure the "hide_everywhere"
|
-- Before we process the source, make sure the "hide_everywhere"
|
||||||
-- names are set to private (TODO, maybe if we want this?)
|
-- names are set to private (TODO, maybe if we want this?)
|
||||||
|
@ -50,6 +50,7 @@ import Data.Stream
|
|||||||
import Data.Strings
|
import Data.Strings
|
||||||
|
|
||||||
import System
|
import System
|
||||||
|
import System.File
|
||||||
|
|
||||||
%default covering
|
%default covering
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import Idris.Version
|
|||||||
|
|
||||||
import IdrisPaths
|
import IdrisPaths
|
||||||
|
|
||||||
|
import Data.So
|
||||||
import System
|
import System
|
||||||
|
|
||||||
-- TODO: Version numbers on dependencies
|
-- TODO: Version numbers on dependencies
|
||||||
|
@ -298,6 +298,7 @@ processType {vars} eopts nest env fc rig vis opts (MkImpTy tfc n_in ty_raw)
|
|||||||
addTyDecl fc (Resolved idx) env ty -- for definition generation
|
addTyDecl fc (Resolved idx) env ty -- for definition generation
|
||||||
addNameType fc (Resolved idx) env ty -- for looking up types
|
addNameType fc (Resolved idx) env ty -- for looking up types
|
||||||
|
|
||||||
|
|
||||||
traverse_ addToSave (keys (getMetas ty))
|
traverse_ addToSave (keys (getMetas ty))
|
||||||
addToSave n
|
addToSave n
|
||||||
log 10 $ "Saving from " ++ show n ++ ": " ++ show (keys (getMetas ty))
|
log 10 $ "Saving from " ++ show n ++ ": " ++ show (keys (getMetas ty))
|
||||||
|
@ -21,6 +21,7 @@ import TTImp.TTImp
|
|||||||
import Yaffle.REPL
|
import Yaffle.REPL
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.So
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
import System
|
import System
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ yaffleMain fname args
|
|||||||
addPrimitives
|
addPrimitives
|
||||||
case span (/= '.') fname of
|
case span (/= '.') fname of
|
||||||
(_, ".ttc") => do coreLift $ putStrLn "Processing as TTC"
|
(_, ".ttc") => do coreLift $ putStrLn "Processing as TTC"
|
||||||
readFromTTC {extra = ()} emptyFC True fname [] []
|
readFromTTC {extra = ()} True emptyFC True fname [] []
|
||||||
coreLift $ putStrLn "Read TTC"
|
coreLift $ putStrLn "Read TTC"
|
||||||
_ => do coreLift $ putStrLn "Processing as TTImp"
|
_ => do coreLift $ putStrLn "Processing as TTImp"
|
||||||
ok <- processTTImpFile fname
|
ok <- processTTImpFile fname
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Data.Fin
|
import Data.Fin
|
||||||
|
import Data.Maybe
|
||||||
|
|
||||||
data NNat = NZ | NS NNat
|
data NNat = NZ | NS NNat
|
||||||
|
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
2/3: Building Mult (Mult.idr)
|
2/3: Building Mult (Mult.idr)
|
||||||
3/3: Building Test (Test.idr)
|
3/3: Building Test (Test.idr)
|
||||||
Test.idr:5:9--5:13:While processing type of thing at Test.idr:5:1--6:1:
|
Test.idr:5:9--5:13:While processing type of thing at Test.idr:5:1--6:1:
|
||||||
Name Nat.Nat is inaccessible since Nat is not explicitly imported
|
Undefined name Nat
|
||||||
Test.idr:6:1--8:1:No type declaration for Test.thing
|
Test.idr:6:1--8:1:No type declaration for Test.thing
|
||||||
Test> Bye for now!
|
Test> Bye for now!
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
1/1: Building Holes (Holes.idr)
|
1/1: Building Holes (Holes.idr)
|
||||||
Holes.idr:4:64--4:85:While processing type of Vect_ext at Holes.idr:4:1--7:1:
|
Holes.idr:4:64--4:85:While processing type of Vect_ext at Holes.idr:4:1--7:1:
|
||||||
Name Builtin.~=~ is inaccessible since Builtin is not explicitly imported
|
Undefined name ~=~
|
||||||
Holes.idr:7:26--8:1:While processing type of Weird at Holes.idr:7:1--8:1:
|
Holes.idr:7:26--8:1:While processing type of Weird at Holes.idr:7:1--8:1:
|
||||||
Name Builtin.~=~ is inaccessible since Builtin is not explicitly imported
|
Undefined name ~=~
|
||||||
Holes.idr:8:1--10:1:No type declaration for Main.Weird
|
Holes.idr:8:1--10:1:No type declaration for Main.Weird
|
||||||
Holes.idr:10:5--10:10:While processing type of f at Holes.idr:10:1--11:1:
|
Holes.idr:10:5--10:10:While processing type of f at Holes.idr:10:1--11:1:
|
||||||
Name Prelude.Bool is inaccessible since Prelude is not explicitly imported
|
Undefined name Bool
|
||||||
Holes.idr:11:1--12:1:No type declaration for Main.f
|
Holes.idr:11:1--12:1:No type declaration for Main.f
|
||||||
Main> (interactive):1:4--1:8:Undefined name help
|
Main> (interactive):1:4--1:8:Undefined name help
|
||||||
Main> (interactive):1:4--1:9:Undefined name hole0
|
Main> (interactive):1:4--1:9:Undefined name hole0
|
||||||
|
@ -2,6 +2,8 @@ import Data.Vect
|
|||||||
import Data.List
|
import Data.List
|
||||||
import Data.Strings
|
import Data.Strings
|
||||||
|
|
||||||
|
import Decidable.Equality
|
||||||
|
|
||||||
%default total
|
%default total
|
||||||
|
|
||||||
data GameState : Type where
|
data GameState : Type where
|
||||||
|
Loading…
Reference in New Issue
Block a user