How to use threadDelay inside a runContextT

Question

I'm currently learning Haskell. (With GPipe)

I have the following code which is part of a program that draws a triangle on the screen:

drawyRun :: IO ()
drawyRun = do
  runContextT GLFW.newContext (ContextFormatColor RGB8) $ do
    threadDelay 10
    vertexBuffer :: Buffer os (B4 Float, B3 Float) <- newBuffer 3
    writeBuffer vertexBuffer 0 [ (V4 (-1) 1 0 1, V3 1 0 0)
                               , (V4 0 (-1) 0 1, V3 0 1 0)
                               , (V4 1 1 0 1,  V3 0 0 1)
                               ]

    shader <- compileShader mainShader

    loop vertexBuffer shader 0.0

That line threadDelay 10 is giving compler erros:

Couldn't match type ‘IO’
                     with ‘ContextT GLFW.GLFWWindow os (ContextFormat RGBFloat ()) IO’
      Expected type: ContextT
                       GLFW.GLFWWindow os (ContextFormat RGBFloat ()) IO ()
        Actual type: IO ()

How do I cause a brief delay inside that runContextT?


Show source
| haskell   | monads   2016-12-18 23:12 0 Answers

Answers to How to use threadDelay inside a runContextT ( 0 )

Leave a reply to - How to use threadDelay inside a runContextT

◀ Go back