> And the one liner:
> (rand 1 10) >>= return . (\v -> take v [1..10])
What about:
take <$> rand 1 10 <*> pure [1..10]
(more readable IMHO).
One could even define:
f <%> x = f <*> pure x
and have
take <$> rand 1 10 <%> [1..10]
Also, why not using getRandomR(1,10) instead?
take <$> getRandomR (1,10) <%> [1..10] :: (MonadRandom m) => m Int
That way you separate the generation from the IO.
My getRandomR(0,3) <%> cents.
--
Ariel J. Birnbaum
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe