@@ -82,7 +82,7 @@ buildPkg copts warnonly (install, fp) = do
8282 Left emsg -> do
8383 putStrLn emsg
8484 exitWith (ExitFailure 1)
85− Right opts -> buildMods opts [idris_main pkgdesc]
85+ Right opts -> buildMain opts (idris_main pkgdesc)
8686 case m_ist of
8787 Nothing -> exitWith (ExitFailure 1)
8888 Just ist -> do
@@ -91,6 +91,11 @@ buildPkg copts warnonly (install, fp) = do
9191 Just _ -> exitWith (ExitFailure 1)
9292 _ -> return ()
9393 when install $ installPkg (opt getIBCSubDir copts) pkgdesc
94+ where
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)
9499
95100-- --------------------------------------------------------- [ Check Packages ]
96101
@@ -140,20 +145,21 @@ replPkg copts fp = do
140145 case mergeOptions copts (idris_opts pkgdesc) of
141146 Left emsg -> ifail emsg
142147 Right opts -> do
143− let mod = idris_main pkgdesc
144− let f = toPath (showCG mod)
145148 putIState orig
146149 dir <- runIO getCurrentDirectory
147150 runIO $ setCurrentDirectory $ dir </> sourcedir pkgdesc
148−
149− if (f /= "")
150− then idrisMain ((Filename f) : opts)
151− else iputStrLn "Can't start REPL: no main module given"
151+ runMain opts (idris_main pkgdesc)
152152 runIO $ setCurrentDirectory dir
153153
154154 where
155155 toPath n = foldl1' (</>) $ splitOn "." n
156156
157+ runMain opts (Just mod) = do
158+ let f = toPath (showCG mod)
159+ idrisMain ((Filename f) : opts)
160+ runMain _ Nothing =
161+ iputStrLn "Can't start REPL: no main module given"
162+
157163-- --------------------------------------------------------------- [ Cleaning ]
158164
159165-- | Clean Package build files