still random number problem

Junjie Xu ceejx@cee.hw.ac.uk
Wed, 24 Jul 2002 19:13:22 +0100 (BST)


Hi there,
First of all, I would say thank you very much for all who helped me during 
the past days.

Since I am a beginner , sometime I spent even several hours to solve a 
very simple problem.So, I still need your help in the future.

The problem is: 

********************************************************
import Random

uni ::  IO () -> Float
uni  = do
     xs <-  newStdGen 
     let
       m =  (head  (randoms xs) :: Float )

doubleit :: Float -> Float
doubleit n = 2.0*n

main = print (doubleit uni)
********************************************************
The result is:


bash-2.05$ ghci
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 5.02.2, for Haskell 
98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.
 
Loading package std ... linking ... done.
Prelude> :cd test
Prelude> :l random.ls
can't find module `random.ls'
Prelude> :l random.hs
Compiling Main             ( random.hs, interpreted )
random.hs:11: The last statement in a 'do' construct must be an expression
Failed, modules loaded: none.
Prelude>

*******************************************************

What is wrong with it? 

Thank you very much.

Kevin