[Haskell-beginners] ghci reports "The last statement in a 'do' construct must be an expression" error

Nico Rolle nico.rolle at googlemail.com
Wed Jun 17 12:13:03 EDT 2009


it really was an indentation error
i configured my editor to expand tabs into spaces but somehow he did a real
tab on line 9 and 10
thank you

2009/6/16 Daniel Fischer <daniel.is.fischer at web.de>

> Am Dienstag 16 Juni 2009 22:35:17 schrieb Nico Rolle:
> > Hi
> >
> > Heres my code snippet.
> > It reports that my error is in line 9 right after the main definition.
> > All functions that i call work under normal circumstances.
> > Thanks
>
> Must be the indentation, probably the xs is indented further than the
> following line
> (though that's not the case for the code copy-pasted from the mail to an
> editor).
>
> But note that this will most likely print out 0 twice.
> The let pnp = ... bindings don't cause any computation to occur.
> To measure the time the computations take, you must force them to occur
> between the two
> calls to getCurrentTime.
>
> >
> >
> > module Benchmark
> >     where
> >
> > import ReadCSV
> > import Operators
> > import Data.Time.Clock (diffUTCTime, getCurrentTime)
> >
> > main = do
> >     xs <- readCSV "dataconvert/lineitem.tbl" '|'
> >     start <- getCurrentTime
> >     let pnp = projection [5] xs
> >     let snp = selection (\x -> (x!!0) > (Int 17000)) pnp
> >     end <- getCurrentTime
> >     putStrLn $ show (end `diffUTCTime` start)
> >     start2 <- getCurrentTime
> >     let pp = pProjection [5] xs
> >     let sp = pSelection (\x -> (x!!0) > (Int 17000)) pp
> >     end2 <- getCurrentTime
> >     putStrLn $ show (end2 `diffUTCTime` start2)
> >     return xs
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090617/c37de581/attachment.html


More information about the Beginners mailing list