2019-03-29 02:37:41 +03:00
|
|
|
module Lib
|
|
|
|
( compile
|
|
|
|
) where
|
|
|
|
|
2019-04-19 16:22:14 +03:00
|
|
|
import Parser
|
2019-03-29 02:37:41 +03:00
|
|
|
import Generator
|
2019-05-04 00:24:57 +03:00
|
|
|
|
2019-02-17 16:04:24 +03:00
|
|
|
|
2019-03-24 14:42:36 +03:00
|
|
|
type CompileError = String
|
|
|
|
|
|
|
|
compile :: FilePath -> FilePath -> IO (Either CompileError ())
|
2019-03-29 02:37:41 +03:00
|
|
|
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 ())
|