@@ -40,11 +40,13 @@ data IState = IState { tt_ctxt :: Context,
40 syntax_keywords :: [String],
40 syntax_keywords :: [String],
41 imported :: [FilePath],
41 imported :: [FilePath],
42 idris_prims :: [(Name, ([E.Name], E.Term))],
42 idris_prims :: [(Name, ([E.Name], E.Term))],
43+ idris_objs :: [FilePath],
44+ idris_libs :: [String],
43 errLine :: Maybe Int
45 errLine :: Maybe Int
46idrisInit = IState emptyContext [] emptyContext emptyContext emptyContext
48idrisInit = IState emptyContext [] emptyContext emptyContext emptyContext
47− "" defaultOpts 6 [] [] [] [] [] Nothing
49+ "" defaultOpts 6 [] [] [] [] [] [] [] Nothing
49-- The monad for the main REPL - reading and processing files and updating
51-- The monad for the main REPL - reading and processing files and updating
50-- global state (hence the IO inner monad).
52-- global state (hence the IO inner monad).
@@ -53,6 +55,18 @@ type Idris a = StateT IState IO a
53getContext :: Idris Context
55getContext :: Idris Context
54getContext = do i <- get; return (tt_ctxt i)
56getContext = do i <- get; return (tt_ctxt i)
58+getObjectFiles :: Idris [FilePath]
59+getObjectFiles = do i <- get; return (idris_objs i)
61+addObjectFile :: FilePath -> Idris ()
62+addObjectFile f = do i <- get; put (i { idris_objs = f : idris_objs i })
64+getLibs :: Idris [String]
65+getLibs = do i <- get; return (idris_libs i)
67+addLib :: String -> Idris ()
68+addLib f = do i <- get; put (i { idris_libs = f : idris_libs i })
56setErrLine :: Int -> Idris ()
70setErrLine :: Int -> Idris ()
57setErrLine x = do i <- get;
71setErrLine x = do i <- get;
58 case (errLine i) of
72 case (errLine i) of
@@ -621,16 +635,16 @@ expandParamsD ist dec ps ns (PClauses fc opts n cs)
621 PClauses fc opts n' (map expandParamsC cs)
635 PClauses fc opts n' (map expandParamsC cs)
623 expandParamsC (PClause n lhs ws rhs ds)
637 expandParamsC (PClause n lhs ws rhs ds)
624− = let ps' = updateps True (namesIn ist rhs) (zip ps [0..])
638+ = let -- ps' = updateps True (namesIn ist rhs) (zip ps [0..])
625− ps'' = updateps False (namesIn ist lhs) (zip ps' [0..])
639+ ps'' = updateps False (namesIn ist lhs) (zip ps [0..])
626 n' = if n `elem` ns then dec n else n in
640 n' = if n `elem` ns then dec n else n in
627 PClause n' (expandParams dec ps'' ns lhs)
641 PClause n' (expandParams dec ps'' ns lhs)
628 (map (expandParams dec ps'' ns) ws)
642 (map (expandParams dec ps'' ns) ws)
629 (expandParams dec ps'' ns rhs)
643 (expandParams dec ps'' ns rhs)
630 (map (expandParamsD ist dec ps'' ns) ds)
644 (map (expandParamsD ist dec ps'' ns) ds)
631 expandParamsC (PWith n lhs ws wval ds)
645 expandParamsC (PWith n lhs ws wval ds)
632− = let ps' = updateps True (namesIn ist wval) (zip ps [0..])
646+ = let -- ps' = updateps True (namesIn ist wval) (zip ps [0..])
633− ps'' = updateps False (namesIn ist lhs) (zip ps' [0..])
647+ ps'' = updateps False (namesIn ist lhs) (zip ps [0..])
634 n' = if n `elem` ns then dec n else n in
648 n' = if n `elem` ns then dec n else n in
635 PWith n' (expandParams dec ps'' ns lhs)
649 PWith n' (expandParams dec ps'' ns lhs)
636 (map (expandParams dec ps'' ns) ws)
650 (map (expandParams dec ps'' ns) ws)