Never been to DZone Snippets before?

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

<- and let .. = confusion (See related posts)

// 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]

You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts