On 22 March 2010 13:49, adamtheturtle <kill2thr...@hotmail.com> wrote: > Just tried the code > 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 I get: > > Could not deduce (Eq a) from the context () > arising from a use of `delete' at Cards.hs:(23,51)-(24,8) > Possible fix: > add (Eq a) to the context of the type signature for `shuffle' > In the second argument of `shuffle', namely > `(delete (cards !! i) cards)' > In the second argument of `(:)', namely > `shuffle (fst pair) (delete (cards !! i) cards)' > In the expression: > (cards !! i) : shuffle (fst pair) (delete (cards !! i) cards) > Failed, modules loaded: none. > > > Any ideas?
Yes: do what it says! Hint: http://hackage.haskell.org/package/random-shuffle -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe