From cb580aeb4fd204a142a72a5a2fc96b5b0acccb16 Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Tue, 14 May 2024 19:08:01 +0300 Subject: [PATCH] Fix syntax for ghc js backend --- JavaScript/Web/AnimationFrame.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/JavaScript/Web/AnimationFrame.hs b/JavaScript/Web/AnimationFrame.hs index a2d62f9..9960bbd 100644 --- a/JavaScript/Web/AnimationFrame.hs +++ b/JavaScript/Web/AnimationFrame.hs @@ -2,6 +2,7 @@ {-# LANGUAGE JavaScriptFFI #-} {-# LANGUAGE InterruptibleFFI #-} {-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE CPP #-} {- | Animation frames are the browser's mechanism for smooth animation. @@ -64,7 +65,11 @@ cancelAnimationFrame h = js_cancelAnimationFrame h foreign import javascript unsafe "(() => { return { handle: null, callback: null }; })" js_makeAnimationFrameHandle :: IO AnimationFrameHandle +#ifdef __GHCJS__ foreign import javascript unsafe "(() => { return { handle: null, callback: $1 }; })" +#else +foreign import javascript unsafe "(($1) => { return { handle: null, callback: $1 }; })" +#endif js_makeAnimationFrameHandleCallback :: JSVal -> IO AnimationFrameHandle foreign import javascript unsafe "h$animationFrameCancel" js_cancelAnimationFrame :: AnimationFrameHandle -> IO ()