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)

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to