haskell / random

Random number library
Other
53 stars 50 forks source link

UniformRange instances for (,) and other Ix #124

Closed ffaf1 closed 2 years ago

ffaf1 commented 2 years ago

I wonder why I can:

λ> :m +Data.Ix
λ> range ((1,1), (2,3))
[(1,1),(1,2),(1,3),(2,1),(2,2),(2,3)]

but I cannot use uniformR on Ix instances (e.g. a tuple). Would it make sense to make those instances of UniformRange?

Bodigrim commented 2 years ago

It's already done, but not released yet.

https://github.com/haskell/random/blob/b89d4117797e646ab55a8fece5b468a2d5b10682/src/System/Random/Internal.hs#L1459-L1464