Quantcast

The last statement in a 'do' construct must be an expression: a <- readArray arr (1, 1)

classic Classic list List threaded Threaded
3 messages Options
KC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

The last statement in a 'do' construct must be an expression: a <- readArray arr (1, 1)

KC
I'm getting the above error message and I cannot figure out why?


buildPair =
    do
arr <- newArray ((1,1),(1,10)) 37 :: ST s (STArray s (Int,Int) Int)
a <- readArray arr (1,1)
        writeArray arr (1,1) 64
        b <- readArray arr (1,1)
        return (a,b)


main = print $ runST buildPair


--
--
Regards,
KC

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The last statement in a 'do' construct must be an expression: a <- readArray arr (1, 1)

Ryan Yates
Perhaps you are mixing tabs and spaces?

On Mon, Apr 23, 2012 at 4:52 PM, KC <[hidden email]> wrote:
I'm getting the above error message and I cannot figure out why?


buildPair =
    do
arr <- newArray ((1,1),(1,10)) 37 :: ST s (STArray s (Int,Int) Int)
a <- readArray arr (1,1)
        writeArray arr (1,1) 64
        b <- readArray arr (1,1)
        return (a,b)


main = print $ runST buildPair


--
--
Regards,
KC

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
KC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The last statement in a 'do' construct must be an expression: a <- readArray arr (1, 1)

KC
Thank you, that was it.

I was mixing up and tabs and spaces.

I expected new versions of NotePad++ to keep my old settings.


On Mon, Apr 23, 2012 at 1:54 PM, Ryan Yates <[hidden email]> wrote:
Perhaps you are mixing tabs and spaces?

On Mon, Apr 23, 2012 at 4:52 PM, KC <[hidden email]> wrote:
I'm getting the above error message and I cannot figure out why?


buildPair =
    do
arr <- newArray ((1,1),(1,10)) 37 :: ST s (STArray s (Int,Int) Int)
a <- readArray arr (1,1)
        writeArray arr (1,1) 64
        b <- readArray arr (1,1)
        return (a,b)


main = print $ runST buildPair


--
--
Regards,
KC

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe





--
--
Regards,
KC

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Loading...