DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

<- And Let .. = Confusion

06.01.2006
| 1251 views |
  • submit to reddit
        // description of your code here

module Main
   where

import Random


main = do
   -- Either of these work
   --rnum <- oneRandNum
   let rnum = oneRandNum

   -- But only let works here. Why?
   --numbers <- randArray
   let numbers = randArray

   -- Required for successful compilation.
   print "foo"


oneRandNum :: IO Int
oneRandNum = getStdRandom( randomR( 0, 9 ) )

randArray :: [IO Int]
randArray = [oneRandNum]