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

2010-03-22 Thread Daniel Fischer
-Ursprüngliche Nachricht- Von: adamtheturtle kill2thr...@hotmail.com Gesendet: 22.03.2010 04:52:19 An: haskell-cafe@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

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

2010-03-21 Thread TeXitoi
boblettoj bobletto...@msn.com writes: 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!

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

2010-03-21 Thread adamtheturtle
boblettoj boblettoj99 at msn.com writes: Haha, much better now! Thanks for all your help, it's working great! 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

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

2010-03-21 Thread Ivan Miljenovic
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

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

2010-03-21 Thread adamtheturtle
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? Cards.hs:39:51: Could not deduce (Eq a) from the context

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

2010-03-21 Thread David Menendez
On Sun, Mar 21, 2010 at 11:31 PM, adamtheturtle kill2thr...@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

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

2010-03-21 Thread Ivan Miljenovic
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 kill2thr...@hotmail.com wrote:    Possible fix:      add (Eq a) to the context of the type signature

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

2010-03-21 Thread adamtheturtle
Ivan Miljenovic ivan.miljenovic at 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 at hotmail.com wrote:    

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

2010-03-21 Thread Ivan Miljenovic
On 22 March 2010 14:52, adamtheturtle kill2thr...@hotmail.com wrote: 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 and I really don't know where to put (Eq a) First of all, do a tutorial