[Haskell-cafe] shuffle error

Henk-Jan van Tuyl hjgtuyl at chello.nl
Mon Mar 2 10:10:27 EST 2009

On Mon, 02 Mar 2009 15:18:17 +0100, friggin friggin  
<frigginfriggins at gmail.com> wrote:

> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=1989#a1990
> Is the algorithm wrong ar am I using it wrong?

The second parameter of extractTree is of type Tree a, you didn't suply a  
line specifying what to do with the value (Leaf a), so you didn't cover  
all possibilities of this type; that's why you get the message  
"Non-exhaustive patterns in function extractTree".

> Also, is the second argument to shuffle supposed to eb random numbers, ie
> the function should be used in the IO Monad?

If you supply a prefabricated random list of Integers, this function can  
be pure (i.e. not in the IO monad)

Met vriendelijke groet,
Henk-Jan van Tuyl


More information about the Haskell-Cafe mailing list