on master help sign in
Add MonadMask generalBraket
34fe7d6Hamish Mackenzie
jsaddle/src/Language/Javascript/JSaddle/Types.hs+7
@@ -178,6 +178,13 @@ instance MonadMask JSM where
178 JSM $ uninterruptibleMask $ \unmask -> unJSM (a $ q unmask)
178 JSM $ uninterruptibleMask $ \unmask -> unJSM (a $ q unmask)
179 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
180 q unmask (JSM b) = syncAfter . JSM $ unmask b
180 q unmask (JSM b) = syncAfter . JSM $ unmask b
181+#if MIN_VERSION_exceptions(0,9,0)
182+ generalBracket acquire release use =
183+ JSM $ generalBracket
184+ (unJSM acquire)
185+ (\resource exitCase -> unJSM $ release resource exitCase)
186+ (unJSM . syncAfter . use)
187+#endif
181
188
182#endif
189#endif
183
190