[Haskell-beginners] Error message: "Couldn't match expected type"

S. H. Aegis shaegis at gmail.com
Thu Oct 2 16:40:30 UTC 2014


Hello.

I'm learning Haskell on OSX.
How can I fix this error message?
(Code from The Haskell School of Expression, P40)
Sorry for border you...

Sok.

import Graphics.SOE

main() =
    runGraphics (
    do  w <- openWindow "My First Graphics Program" (300, 300)
        drawInWindow w (text(100, 200) "HelloFraphicsWorld")
        spaceClose w
    )

spaceClose :: Window -> IO()
spaceClose w
    =   do  k <- getKey w
            if k == ' ' then closeWindow w
                        else spaceClose w


[1 of 1] Compiling Main             ( firstGraphics.hs, firstGraphics.o )

firstGraphics.hs:3:1:
    Couldn't match expected type `IO t0' with actual type `() -> IO ()'
    In the expression: main
    When checking the type of the function `main'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141003/bbfd9ce6/attachment.html>


More information about the Beginners mailing list