I have a system in haskell that uses Data.Dynamic and Type.Reflection to perform inference and calculations. I would like to be able to generate dynamic data randomly.
Generating dynamic data is easy when the type is known.
goo :: SomeTypeRep -> IO (Dynamic)
goo str = case tyConName . someTypeRepTyCon $ str of
"Int" -> return . toDyn . randomRIO $ (-20, 100::Int)
"Bool" -> return . toDyn . randomRIO $ (True, False)
_ -> error "no chance"
But having a new line for every type is impractical when handling tuples.
Is there a way to combine n dynamics into a tuple? Or is there another way to generate the tuples dynamically?