Typical signature "Maybe" does not like "Just [Event]"

I'm still learning Haskell and need help with the output type, please!

Using SDL and Yampa packages I get the following type signature from FRP.Yampa.reactimate:

(Bool -> IO (DTime, Maybe a))

and I want to use it for:

myInput :: Bool -> IO (DTime, Maybe [SDL.Event])
myInput isBlocking = do
    event <- SDL.pollEvent
    return (1, Just [event])
...
reactimate myInit myInput myOutput mySF

but he says

Couldn't match expected type `() '
       against inferred type `[SDL.Event] '
  Expected type: IO (DTime, Maybe ())
  Inferred type: IO (DTime, Maybe [SDL.Event])
In the second argument of `reactimate ', namely` input'
In the expression: reactimate initialize input output process

, Maybe a -, SDL.Event? Maybe (), Maybe a? , , , , ()?

+3
1

reactimate -

IO a                               -- # myInit
 -> (Bool -> IO (DTime, Maybe a))  -- # myInput
 -> (Bool -> b -> IO Bool)         -- # myOutput
 -> SF a b                         -- # mySF
 -> IO ()

a b , , myInput Bool -> IO (DTime, Maybe [SDL.Event]), a [SDL.Event]. , ,

 myInit :: IO [SDL.Event]     -- # **not** IO ().
 mySF :: SF [SDL.Event] b

BTW, () - .

+8

Source: https://habr.com/ru/post/1746836/


All Articles