wasp/src/Lib.hs

20 lines
421 B
Haskell
Raw Normal View History

module Lib
( compile
) where
2019-04-19 16:22:14 +03:00
import Parser
import Generator
type CompileError = String
compile :: FilePath -> FilePath -> IO (Either CompileError ())
compile waspFile outDir = do
2019-04-19 16:22:14 +03:00
waspStr <- readFile waspFile
case parseWasp waspStr of
Left err -> return $ Left (show err)
Right wasp -> generateCode wasp
where
generateCode wasp = writeWebAppCode wasp outDir >> return (Right ())