[Haskell-cafe] better way to do this?
Michael Mossey
mpm at alumni.caltech.edu
Sun Oct 4 05:52:54 EDT 2009
I'm looking for a hint to write the following code with less redundancy. I
have a constructor called BoxBounds, and I want to make one with random
values.
randomBox :: IO BoxBounds
randomBox = do
x <- getStdRandom (randomR (-10,10))
y <- getStdRandom (randomR (-70,70))
t <- getStdRandom (randomR (5,10))
b <- getStdRandom (randomR (5,10))
l <- getStdRandom (randomR (5,10))
r <- getStdRandom (randomR (5,10))
return (BoxBounds x y l r t b)
More information about the Haskell-Cafe
mailing list