apiary-purescript 0.14.0.1 → 0.15.2
raw patch · 2 files changed
+21/−24 lines, 2 filesdep ~apiaryPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: apiary
API changes (from Hackage documentation)
Files
- apiary-purescript.cabal +12/−12
- src/Web/Apiary/PureScript/Internal.hs +9/−12
apiary-purescript.cabal view
@@ -1,5 +1,5 @@ name: apiary-purescript-version: 0.14.0.1+version: 0.15.2 synopsis: purescript compiler for apiary web framework. description: example: <https://github.com/philopon/apiary/blob/master/examples/pureScript.hs>@@ -20,18 +20,18 @@ exposed-modules: Web.Apiary.PureScript Web.Apiary.PureScript.Explicit other-modules: Web.Apiary.PureScript.Internal- build-depends: base >=4.6 && <4.8+ build-depends: base >=4.6 && <4.8 , template-haskell- , apiary >=0.14 && <0.16- , purescript >=0.5 && <0.6- , filepath >=1.3 && <1.4- , utf8-string >=0.3 && <0.4- , text >=1.1 && <1.2- , bytestring >=0.10 && <0.11- , unordered-containers >=0.2 && <0.3- , reflection >=1.4 && <1.6- , parsec >=3.1 && <3.2- , Glob >=0.7 && <0.8+ , apiary >=0.15.2 && <0.16+ , purescript >=0.5 && <0.6+ , filepath >=1.3 && <1.4+ , utf8-string >=0.3 && <0.4+ , text >=1.1 && <1.2+ , bytestring >=0.10 && <0.11+ , unordered-containers >=0.2 && <0.3+ , reflection >=1.4 && <1.6+ , parsec >=3.1 && <3.2+ , Glob >=0.7 && <0.8 hs-source-dirs: src ghc-options: -O2 -Wall
src/Web/Apiary/PureScript/Internal.hs view
@@ -24,10 +24,6 @@ import Data.Typeable import qualified Data.HashMap.Strict as H import qualified Text.Parsec.Error as P-import qualified Data.Text.Lazy as T-import qualified Data.Text.Lazy.Encoding as T-import qualified Data.ByteString.Lazy as L-import qualified Data.ByteString.Lazy.Char8 as LC import qualified Paths_apiary_purescript as Path @@ -70,7 +66,7 @@ data PureScript = PureScript { pscConfig :: PureScriptConfig- , compiled :: IORef (H.HashMap FilePath L.ByteString)+ , compiled :: IORef (H.HashMap FilePath String) } withPureScript :: MonadIO m => PureScriptConfig -> (PureScript -> m b) -> m b@@ -96,13 +92,13 @@ let prel = preludePath conf concat `fmap` mapM readPscInput (prel : mods) -compile :: PureScriptConfig -> FilePath -> IO L.ByteString+compile :: PureScriptConfig -> FilePath -> IO String compile opt p = do mods <- pscModules opt mn <- readPscInput p case P.compile (pureScriptOptions opt) $ mn ++ mods of Left l -> throwIO (CompileError l)- Right (js, _, _) -> return . T.encodeUtf8 $ T.pack js+ Right (js, _, _) -> return js pureScript :: MonadIO m => PureScript -> FilePath -> ActionT m () pureScript env p = do@@ -117,11 +113,12 @@ return r Just r -> return r case s of- Right r -> lbs r- Left e | development (pscConfig env) -> - lbs . LC.pack $ "alert(\"" ++ pr (e::PureScriptException) ++ "\")"-- | otherwise -> lbs "alert(\"PureScript error.\");"+ Right r -> string r+ Left e | development (pscConfig env) -> do+ bytes "console.log(\""+ string $ pr (e :: PureScriptException)+ bytes "\")"+ | otherwise -> bytes "console.log(\"PureScript error.\");" where pr = concatMap esc . show esc '"' = "\\\""