@@ -22,8 +22,8 @@ module Miso.Subscription.Keyboard
22
22
-----------------------------------------------------------------------------
23
23
import Control.Monad.IO.Class
24
24
import Data.IORef
25
- import Data.Set
26
- import qualified Data.Set as S
25
+ import Data.IntSet
26
+ import qualified Data.IntSet as S
27
27
import Language.Javascript.JSaddle hiding (new )
28
28
-----------------------------------------------------------------------------
29
29
import Miso.Effect (Sub )
@@ -43,7 +43,7 @@ data Arrows
43
43
-----------------------------------------------------------------------------
44
44
-- | Helper function to convert keys currently pressed to @Arrows@, given a
45
45
-- mapping for keys representing up, down, left and right respectively.
46
- toArrows :: ([Int ], [Int ], [Int ], [Int ]) -> Set Int -> Arrows
46
+ toArrows :: ([Int ], [Int ], [Int ], [Int ]) -> IntSet -> Arrows
47
47
toArrows (up, down, left, right) set' = Arrows
48
48
{ arrowX =
49
49
case (check left, check right) of
@@ -75,7 +75,7 @@ directionSub dirs = keyboardSub . (. toArrows dirs)
75
75
-----------------------------------------------------------------------------
76
76
-- | Returns subscription for Keyboard.
77
77
-- The callback will be called with the Set of currently pressed @keyCode@s.
78
- keyboardSub :: (Set Int -> action ) -> Sub action
78
+ keyboardSub :: (IntSet -> action ) -> Sub action
79
79
keyboardSub f sink = do
80
80
keySetRef <- liftIO (newIORef mempty )
81
81
FFI. windowAddEventListener " keyup" $ keyUpCallback keySetRef
0 commit comments