[Haskell-cafe] Re: Occurs check error, help!

David Menendez dave at zednenem.com
Sun Mar 21 23:44:29 EDT 2010


On Sun, Mar 21, 2010 at 11:31 PM, adamtheturtle <kill2thrill at hotmail.com> wrote:
> So I have 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 it doesn't work, am I missing something?

Are you familiar with class constraints? Try looking at the type of
delete. (Use ":type" at the ghci prompt.)

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list