Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What can cause jsaddle Results decode failed exception when using fun? #55

Open
Wizek opened this issue Feb 2, 2018 · 2 comments
Open

Comments

@Wizek
Copy link
Contributor

Wizek commented Feb 2, 2018

I've been trying to use the fun and function functions from here: https://hackage.haskell.org/package/jsaddle-0.9.4.0/docs/Language-Javascript-JSaddle-Object.html#v:fun

And I've ran into exceptions like this:

jsaddle3-exe: jsaddle Results decode failed : "{\"tag\":\"Callback\",\"contents\":[0,{},-2,101,102,[103]]}"
CallStack (from HasCallStack):
  error, called at src/Language/Javascript/JSaddle/WebSockets.hs:85:40 in jsaddle-warp-0.9.5.0-EK8DFrM2ZlV7tdElT9ks2n:Language.Javascript.JSaddle.WebSockets

Here is a reproducible minimal example from the docs: Wizek/jsaddle3@967b32~2...967b32

Aside; I've also tried creating a minimal repro case with nix like this:

#!/usr/bin/env nix-shell
#! nix-shell -p "haskell.packages.ghc822.ghcWithPackages (p: with p; with haskell.lib; [(doJailbreak (dontCheck jsaddle-warp))])"
#! nix-shell -i "runghc"

{-# language OverloadedStrings #-}

import            Control.Monad.IO.Class
import            Language.Javascript.JSaddle.Warp
import            Language.Javascript.JSaddle
import            Language.Javascript.JSaddle.Debug
import            Control.Concurrent
import            Control.Monad
import            Data.Text
import            Control.Concurrent.MVar

main = run 3197 $ do
  result <- liftIO newEmptyMVar
  deRefVal $ call (eval "(function(f) {f('Hello');})") global [fun $ \ _ _ [arg1] -> do
    valToText arg1 >>= (liftIO . putMVar result)
    ]
  liftIO $ takeMVar result

But I've run into the following likely unrelated issue:

Configuring jsaddle-warp-0.9.5.0...
CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:948:20 in Cabal-2.0.1.0:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:470:12 in Cabal-2.0.1.0:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:570:20 in Cabal-2.0.1.0:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.0.1.0:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:174:19 in Cabal-2.0.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:119:27 in Cabal-2.0.1.0:Distribution.Simple
  defaultMain, called at Setup.lhs:5:10 in main:Main
Setup: Encountered missing dependencies:
websockets >=0.9.5.0 && <0.11
builder for ‘/nix/store/76y9xrhvb0hmq2s46qzsvqv1131z13yh-jsaddle-warp-0.9.5.0.drv failed with exit code 1
killing process 105483

A bit of background:

@Wizek
Copy link
Contributor Author

Wizek commented Feb 5, 2018

I've updated the repro case a bit to get jsaddle too from the same GH commit; new commits will
be visible in this view: Wizek/jsaddle3@967b32~2...master

hamishmack added a commit that referenced this issue Feb 5, 2018
@Wizek
Copy link
Contributor Author

Wizek commented Feb 7, 2018

If anyone is reading this later, in brief testing sessions fb9ba5a seems to have fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant