[Haskell-beginners] exercise 3.10 in YAHT

Brent Yorgey byorgey at seas.upenn.edu
Tue Jun 9 01:17:49 EDT 2009


On Tue, Jun 09, 2009 at 12:05:21AM -0400, George Huber wrote:
>
> loading the file that contains the above function into GHCi (version 6.8.3) 
> gives the following error "The last statement in a 'do' construct must be 
> an expression"
>

This error can also sometimes be triggered by indentation problems.
Check to make sure you are using only spaces and not tabs to
indent. (Tabs are interpreted as a certain number of spaces by ghc---I
forget how many---which may be different than the number of spaces
your editor is configured to show them as, which can lead to
indentation being screwy.  Good Haskell practice is to never use tabs;
in practice most editors have an option to turn tabs into spaces.)

Dunno if that's really your problem but it's worth a shot!

-Brent


More information about the Beginners mailing list