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

2010-03-22 Thread Daniel Fischer
-Ursprüngliche Nachricht- Von: adamtheturtle Gesendet: 22.03.2010 04:52:19 An: haskell-cafe@haskell.org Betreff: [Haskell-cafe] Re: Occurs check error, help! >Ivan Miljenovic writes: > >> >> Since my answer before to your question obviously wasn't clear enough,

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

2010-03-21 Thread Ivan Miljenovic
On 22 March 2010 14:52, adamtheturtle 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 or something r

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

2010-03-21 Thread adamtheturtle
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 hotmail.com> wrote: > >    Possible fix: > >      add

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 wrote: >    Possible fix: >      add (Eq a) to the context of the type signature for `shuffle' Alternat

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

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

[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 Ivan Miljenovic
On 22 March 2010 13:49, adamtheturtle 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)

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

2010-03-21 Thread adamtheturtle
boblettoj 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 (0, 51)

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

2010-03-21 Thread TeXitoi
boblettoj 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! > > --function used