on master help sign in
Merge pull request #43 from bitonic/unliftio
075d1a0Hamish Mackenzie
jsaddle/default.nix+3−2
@@ -1,7 +1,8 @@
1{ mkDerivation, aeson, attoparsec, base, base64-bytestring
1{ mkDerivation, aeson, attoparsec, base, base64-bytestring
2, bytestring, containers, deepseq, filepath, ghc-prim, http-types
2, bytestring, containers, deepseq, filepath, ghc-prim, http-types
3, lens, primitive, process, random, ref-tf, scientific, stdenv, stm
3, lens, primitive, process, random, ref-tf, scientific, stdenv, stm
4−, text, time, transformers, unordered-containers, vector
4+, text, time, transformers, unordered-containers, unliftio-core
5+, vector
5}:
6}:
6mkDerivation {
7mkDerivation {
7 pname = "jsaddle";
8 pname = "jsaddle";
@@ -11,7 +12,7 @@ mkDerivation {
11 aeson attoparsec base base64-bytestring bytestring containers
12 aeson attoparsec base base64-bytestring bytestring containers
12 deepseq filepath ghc-prim http-types lens primitive process random
13 deepseq filepath ghc-prim http-types lens primitive process random
13 ref-tf scientific stm text time transformers unordered-containers
14 ref-tf scientific stm text time transformers unordered-containers
14− vector
15+ unliftio-core vector
15 ];
16 ];
16 description = "Interface for JavaScript that works with GHCJS and GHC";
17 description = "Interface for JavaScript that works with GHCJS and GHC";
17 license = stdenv.lib.licenses.mit;
18 license = stdenv.lib.licenses.mit;
jsaddle/jsaddle.cabal+2−1
@@ -48,7 +48,8 @@ library
48 stm >=2.4.4 && <2.5,
48 stm >=2.4.4 && <2.5,
49 time >=1.5.0.1 && <1.9,
49 time >=1.5.0.1 && <1.9,
50 unordered-containers >=0.2 && <0.3,
50 unordered-containers >=0.2 && <0.3,
51− vector >=0.10 && <0.13
51+ vector >=0.10 && <0.13,
52+ unliftio-core >=0.1 && < 0.2
52 exposed-modules:
53 exposed-modules:
53 Data.JSString
54 Data.JSString
54 Data.JSString.Internal
55 Data.JSString.Internal
jsaddle/src/Language/Javascript/JSaddle/Types.hs+3−1
@@ -123,6 +123,7 @@ import Data.Coerce (coerce, Coercible)
123import Data.Aeson
123import Data.Aeson
124 (defaultOptions, genericToEncoding, ToJSON(..), FromJSON(..), Value)
124 (defaultOptions, genericToEncoding, ToJSON(..), FromJSON(..), Value)
125import GHC.Generics (Generic)
125import GHC.Generics (Generic)
126+import Control.Monad.IO.Unlift (MonadUnliftIO)
126#endif
127#endif
127
128
128#if MIN_VERSION_base(4,9,0) && defined(CHECK_UNCHECKED)
129#if MIN_VERSION_base(4,9,0) && defined(CHECK_UNCHECKED)
@@ -164,7 +165,7 @@ data JSContextRef = JSContextRef {
164type JSM = IO
165type JSM = IO
165#else
166#else
166newtype JSM a = JSM { unJSM :: ReaderT JSContextRef IO a }
167newtype JSM a = JSM { unJSM :: ReaderT JSContextRef IO a }
167− deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadThrow)
168+ deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadThrow, MonadUnliftIO)
168
169
169instance MonadCatch JSM where
170instance MonadCatch JSM where
170 t `catch` c = JSM (unJSM (syncAfter t) `catch` \e -> unJSM (c e))
171 t `catch` c = JSM (unJSM (syncAfter t) `catch` \e -> unJSM (c e))
@@ -177,6 +178,7 @@ instance MonadMask JSM where
177 JSM $ uninterruptibleMask $ \unmask -> unJSM (a $ q unmask)
178 JSM $ uninterruptibleMask $ \unmask -> unJSM (a $ q unmask)
178 where q :: (ReaderT JSContextRef IO a -> ReaderT JSContextRef IO a) -> JSM a -> JSM a
179 where q :: (ReaderT JSContextRef IO a -> ReaderT JSContextRef IO a) -> JSM a -> JSM a
179 q unmask (JSM b) = syncAfter . JSM $ unmask b
180 q unmask (JSM b) = syncAfter . JSM $ unmask b
181+
180#endif
182#endif
181
183
182-- | Forces execution of pending asyncronous code
184-- | Forces execution of pending asyncronous code