[Haskell-cafe] Re: Occurs check error, help!
daniel.is.fischer at web.de
Mon Mar 22 04:51:18 EDT 2010
Von: adamtheturtle <kill2thrill at hotmail.com>
Gesendet: 22.03.2010 04:52:19
An: haskell-cafe at haskell.org
Betreff: [Haskell-cafe] Re: Occurs check error, help!
>Ivan Miljenovic <ivan.miljenovic [ gmail.com> writes:
>> Since my answer before to your question obviously wasn't clear enough,
>> let me highlight the lines of the error message that summarise what
>> you have to do:
>> On 22 March 2010 14:31, adamtheturtle <kill2thrill [ hotmail.com>
>> > Possible fix:
>> > add (Eq a) to the context of the type signature for `shuffle'
>> Alternatively, use the random-shuffle package rather than coding your own.
>So sorry to keep on going on about this but I have been set to start with
>"shuffle :: Int -> [a] -> [a]" so I have to do that and can't use the given code
>really don't know where to put (Eq a)
shuffle :: Eq a => Int -> [a] -> [a]
Another option is to remove the call to delete, after all, what you want isn't to remove the first occurrence of an element equal to (cards !! i) from cards, but you want to remove element No. i from cards. You can simply achieve that without any type-class constraint. Take a look at take, drop and splitAt. Those should help you.
>Thank you so much for replying :)
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
More information about the Haskell-Cafe