
newStdGen results in IO Ints whereas i need normal Ints and it seems theres no easy way to convert them without a lot more knowledge of haskell. I have tried using a where clause instead of using do but this is giving me the occurs check error again! --function used to shuffle cards --list equals random member of array plus the rest of the array --i is randomly generated from range of length equal to that of cards. shuffle :: Int -> [a] -> [a] shuffle i [] = [] shuffle i cards = [(cards!!i) : shuffle (fst pair) (delete (cards!!i) cards)] where pair = randomR (0, 51) (mkStdGen 42) and the error: cards.hs:30:0: Occurs check: cannot construct the infinite type: a = [a] When generalising the type(s) for `shuffle' Failed, modules loaded: none. hmmm... -- View this message in context: http://old.nabble.com/Occurs-check-error%2C-help%21-tp27966341p27973881.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.