-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
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!
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
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
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
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
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
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:
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