om-elm 1.0.0.3 → 2.0.0.0
raw patch · 2 files changed
+16/−18 lines, 2 filesdep ~Cabaldep ~basedep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal, base, containers, template-haskell
API changes (from Hackage documentation)
Files
- om-elm.cabal +5/−5
- src/System/Elm/Middleware.hs +11/−13
om-elm.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: om-elm-version: 1.0.0.3+version: 2.0.0.0 synopsis: Haskell utilities for building embedded Elm programs. description: This package provides utilities for serving Elm programs directly from your Haskell binary. It uses TemplateHaskell@@ -29,15 +29,15 @@ -- other-modules: -- other-extensions: build-depends:- Cabal >= 2.0.1.1 && < 2.3,- base >= 4.9 && < 4.12,+ Cabal >= 2.0.1.1 && < 2.5,+ base >= 4.9 && < 4.13, bytestring >= 0.10.8.1 && < 0.11,- containers >= 0.5.7.1 && < 0.6,+ containers >= 0.5.7.1 && < 0.7, directory >= 1.3.0.0 && < 1.4, http-types >= 0.9.1 && < 0.13, safe >= 0.3.15 && < 0.4, safe-exceptions >= 0.1.6.0 && < 0.2,- template-haskell >= 2.11.1.0 && < 2.14,+ template-haskell >= 2.11.1.0 && < 2.15, text >= 1.2.2.2 && < 1.3, unix >= 2.7.2.1 && < 2.8, wai >= 3.2.1.1 && < 3.3
src/System/Elm/Middleware.hs view
@@ -48,7 +48,6 @@ import Data.Monoid ((<>)) import Data.String (IsString, fromString) import Data.Text (Text)-import Data.Text.Encoding (decodeUtf8) import Distribution.Simple (hookedPrograms, simpleUserHooks, preConf, UserHooks) import Distribution.Simple.Program (simpleProgram, Program,@@ -68,10 +67,11 @@ import qualified Data.ByteString as BS import qualified Data.Map as Map import qualified Data.Text as T+import qualified Data.ByteString.Char8 as BS8 {- |- Add the elm-make program requirements to a set of build hooks. This is+ Add the elm program requirements to a set of build hooks. This is expected to be used in your Setup.hs file thusly: > import Distribution.Simple (defaultMainWithHooks, simpleUserHooks)@@ -92,9 +92,9 @@ preConf simpleUserHooks args flags } where- {- | A description of the elm-make program. -}+ {- | A description of the elm program. -} elmProg :: Program- elmProg = simpleProgram "elm-make"+ elmProg = simpleProgram "elm" {- |@@ -128,12 +128,11 @@ elmSite2 :: Bool -> Map PathInfo FilePath -> Q (TExp Middleware) elmSite2 debug spec =- buildMiddleware =<< (+ buildMiddleware =<< mapM (\(u, c) -> (u,) <$> c) [ (uriPath, compileElm uriPath elmFile) | (fmap T.unpack -> uriPath, elmFile) <- Map.toList spec ]- ) where {- | Construct the middleware from a set of compiled elm resources. -} buildMiddleware :: [([String], (String, String))] -> Q (TExp Middleware)@@ -167,22 +166,21 @@ void . tryAny $ removeDirectoryRecursive buildDir createDirectory buildDir putStrLn $ "Compiling elm file: " ++ elmFile- forkProcess (executeFile "elm-make" True ([+ forkProcess (executeFile "elm" True ([+ "make", elmFile,- "--yes", "--output=" <> buildFile ] ++ bool [] ["--debug"] debug) Nothing) >>= getProcessStatus True True >>= \case- Nothing -> fail "elm-make should have ended."+ Nothing -> fail "elm should have ended." Just (Exited ExitSuccess) -> (contentType,)- . T.unpack- . decodeUtf8+ . BS8.unpack <$> BS.readFile buildFile- e -> fail $ "elm-make failed with: " ++ show e+ e -> fail $ "elm failed with: " ++ show e where {- | The name of the build directory. We have to have a build- directory because elm-make won't output compile results to+ directory because elm won't output compile results to stdout. It will only output them to files. -} buildDir :: (IsString a) => a