@@ -82,7 +82,7 @@ buildPkg copts warnonly (install, fp) = do
82 Left emsg -> do
82 Left emsg -> do
83 putStrLn emsg
83 putStrLn emsg
84 exitWith (ExitFailure 1)
84 exitWith (ExitFailure 1)
85− Right opts -> buildMods opts [idris_main pkgdesc]
85+ Right opts -> buildMain opts (idris_main pkgdesc)
86 case m_ist of
86 case m_ist of
87 Nothing -> exitWith (ExitFailure 1)
87 Nothing -> exitWith (ExitFailure 1)
88 Just ist -> do
88 Just ist -> do
@@ -91,6 +91,11 @@ buildPkg copts warnonly (install, fp) = do
91 Just _ -> exitWith (ExitFailure 1)
91 Just _ -> exitWith (ExitFailure 1)
92 _ -> return ()
92 _ -> return ()
93 when install $ installPkg (opt getIBCSubDir copts) pkgdesc
93 when install $ installPkg (opt getIBCSubDir copts) pkgdesc
95+ buildMain opts (Just mod) = buildMods opts [mod]
96+ buildMain _ Nothing = do
97+ putStrLn "Can't build an executable: No main module given"
98+ exitWith (ExitFailure 1)
95-- --------------------------------------------------------- [ Check Packages ]
100-- --------------------------------------------------------- [ Check Packages ]
@@ -140,20 +145,21 @@ replPkg copts fp = do
140 case mergeOptions copts (idris_opts pkgdesc) of
145 case mergeOptions copts (idris_opts pkgdesc) of
141 Left emsg -> ifail emsg
146 Left emsg -> ifail emsg
142 Right opts -> do
147 Right opts -> do
143− let mod = idris_main pkgdesc
144− let f = toPath (showCG mod)
145 putIState orig
148 putIState orig
146 dir <- runIO getCurrentDirectory
149 dir <- runIO getCurrentDirectory
147 runIO $ setCurrentDirectory $ dir </> sourcedir pkgdesc
150 runIO $ setCurrentDirectory $ dir </> sourcedir pkgdesc
148−
151+ runMain opts (idris_main pkgdesc)
150− then idrisMain ((Filename f) : opts)
151− else iputStrLn "Can't start REPL: no main module given"
152 runIO $ setCurrentDirectory dir
152 runIO $ setCurrentDirectory dir
155 toPath n = foldl1' (</>) $ splitOn "." n
155 toPath n = foldl1' (</>) $ splitOn "." n
157+ runMain opts (Just mod) = do
158+ let f = toPath (showCG mod)
159+ idrisMain ((Filename f) : opts)
161+ iputStrLn "Can't start REPL: no main module given"
157-- --------------------------------------------------------------- [ Cleaning ]
163-- --------------------------------------------------------------- [ Cleaning ]
159-- | Clean Package build files
165-- | Clean Package build files