A peer-to-peer stack for code collaboration
Get GHCJS client compiling again.
Julian Arnic299bf4e2729
diff --git a/exe/Server/GHCJS.hs b/exe/Server/GHCJS.hsindex 0f56345..f84f8df 100644--- a/exe/Server/GHCJS.hs+++ b/exe/Server/GHCJS.hs@@ -43,13 +43,13 @@ foreign import javascript unsafe "eval_fn_ = $1"-- with the result.---- The IORef keeps the state/env of the REPL so far.-jsEval :: IORef (Bindings (InputT IO)) -> JSVal -> IO ()+jsEval :: IORef (Bindings (PrimFns (InputT IO))) -> JSVal -> IO ()jsEval bndsRef v = runInputT defaultSettings $ dolet o = Object vms <- liftIO $ fromJSVal =<< getProp "arg" olet s = case ms ofJust s' -> s'- _ -> error "expecting 'arg' key"+ _ -> panic "expecting 'arg' key"bnds <- liftIO $ readIORef bndsRefres <- runLang bnds $ interpretMany "[repl]" sout <- JSS.pack . T.unpack <$> case res of@@ -62,48 +62,48 @@ jsEval bndsRef v = runInputT defaultSettings $ do-- * Primops-bindings :: Bindings (InputT IO)-bindings = e { bindingsPrimops = bindingsPrimops e <> primops }+bindings :: Bindings (PrimFns (InputT IO))+bindings = e { bindingsPrimFns = bindingsPrimFns e <> primops }where- e :: Bindings (InputT IO)+ e :: Bindings (PrimFns (InputT IO))e = pureEnv-primops :: Primops (InputT IO)-primops = fromList [sendPrimop, receivePrimop] <> replPrimops+primops :: PrimFns (InputT IO)+primops = PrimFns (fromList [sendPrimop, receivePrimop]) <> replPrimFnswheresendPrimop =- ( Ident "send!"- , evalArgs $ \case+ ( unsafeToIdent "send!"+ , \case[String name, v] -> dores <- liftIO $ runClientM (submit $ List $ [String name, v])case res of- Left e -> throwError . OtherError+ Left e -> throwErrorHere . OtherError$ "send!: failed:" <> show eRight () -> pure $ List []- [_, _] -> throwError $ TypeError "send!: first argument should be a string"- xs -> throwError $ WrongNumberOfArgs "send!" 2 (length xs)+ [_, _] -> throwErrorHere $ TypeError "send!: first argument should be a string"+ xs -> throwErrorHere $ WrongNumberOfArgs "send!" 2 (length xs))receivePrimop =- ( Ident "receive!"- , evalArgs $ \case+ ( unsafeToIdent "receive!"+ , \case[String name, Number n] -> docase floatingOrInteger n of- Left (_ :: Float) -> throwError . OtherError+ Left (_ :: Float) -> throwErrorHere . OtherError$ "receive!: expecting int argument"Right r -> doliftIO (runClientM (since name r)) >>= \case- Left err -> throwError . OtherError+ Left err -> throwErrorHere . OtherError$ "receive!: request failed:" <> show errRight v' -> pure $ List v'- [String _, _] -> throwError $ TypeError "receive!: expecting number as second arg"- [_, _] -> throwError $ TypeError "receive!: expecting string as first arg"- xs -> throwError $ WrongNumberOfArgs "receive!" 2 (length xs)+ [String _, _] -> throwErrorHere $ TypeError "receive!: expecting number as second arg"+ [_, _] -> throwErrorHere $ TypeError "receive!: expecting string as first arg"+ xs -> throwErrorHere $ WrongNumberOfArgs "receive!" 2 (length xs))-- * HelpersidentV :: Text -> Value-identV = Keyword . Ident+identV = Keyword . unsafeToIdent-- * Client functionsdiff --git a/package.yaml b/package.yamlindex 3464bba..9f0b0ee 100644--- a/package.yaml+++ b/package.yaml@@ -34,7 +34,7 @@ when:- condition: impl(ghcjs)dependencies: ghcjs-domghc-options:- -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wpartial-fields+ -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraintsdata-files:- rad/**/*.raddiff --git a/stack-ghcjs.yaml b/stack-ghcjs.yamlindex c9c71d3..9c1686e 100644--- a/stack-ghcjs.yaml+++ b/stack-ghcjs.yaml@@ -1,13 +1,12 @@-resolver: lts-7.24-compiler: ghcjs-0.2.1.9007019_ghc-8.0.1+resolver: nightly-2018-04-21+compiler: ghcjs-0.2.1.9011009_ghc-8.4.1compiler-check: match-exactsetup-info:ghcjs:source:- ghcjs-0.2.1.9007019_ghc-8.0.1:- url: http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz- sha1: d2cfc25f9cda32a25a87d9af68891b2186ee52f9+ ghcjs-0.2.1.9011009_ghc-8.4.1:+ url: https://github.com/alexanderkjeldaas/ghcjs/releases/download/fghcjs-8.4.1/ghcjs.tar.gzpackages:- .extra-deps:@@ -17,35 +16,13 @@ extra-deps:- serialise- cborg- git: https://github.com/ghcjs/ghcjs-base.git- commit: 3bb9ed0ffd3f384ed37456b4d6247be732c79c8e+ commit: 01014ade3f8f5ae677df192d7c2a208bd795b96c- git: [email protected]:haskell-servant/servant.gitcommit: c3caa149551843fdd74eb5abf3251a16547161ddsubdirs:- servant- servant-client-ghcjs- servant-client-core-- aeson-1.2.4.0-- attoparsec-0.13.2.2-- attoparsec-iso8601-1.0.0.0-- cabal-doctest-1.0.6-- case-insensitive-1.2.0.11-- free-4.12.4-- natural-transformation-0.4-- th-abstraction-0.2.8.0-- mmorph-1.1.2-- singleton-bool-0.1.4-- vault-0.3.1.2-- base-compat-0.9.3-- exceptions-0.10.0-- generics-sop-0.3.2.0-- http-api-data-0.3.8.1-- http-media-0.7.1.2-- http-types-0.12.1-- safe-0.3.17-- text-1.2.3.0-- megaparsec-6.4.1-- parser-combinators-0.4.0-- prettyprinter-1.2.1-- prettyprinter-ansi-terminal-1.1.1.2- ghcjs-dom-0.9.2.0+- terminfo-0.4.1.2- ghcjs-dom-jsffi-0.9.2.0