[Haskell-cafe] do... error

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Dec 8 21:42:15 EST 2007


On Dec 8, 2007, at 21:40 , Brandon S. Allbery KF8NH wrote:

>
> On Dec 8, 2007, at 21:38 , Ryan Bloor wrote:
>
>>  test :: Parser (Char,Char)
>>  test  = do x <- item
>>                item
>
> The second and subsequent lines are indented too much, so are read  
> as a continuation of the first; which, starting with "x <- ", is  
> not an expression.

I neglected to say the proper indentation:

   test  = do x <- item
              item      -- note, indented to match the token after  
the "do"
              y <- item
              return (x,y)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list