Reputation: 2449
How can I parametrize a data type with a random generator data type? I tried this:
data DataType g = Data (RandomGen g)
But I get
Predicate `RandomGen g' used as a type
In the type `RandomGen g'
In the definition of data constructor `Data'
In the data declaration for `DataType'
Failed, modules loaded: GameState.
Upvotes: 0
Views: 94
Reputation: 34411
RandomGen
is a type class, not type. Use StdGen
if that fits you. And it isn't parametrized by anything, so you need just data DataType = Data StdGen
.
Upvotes: 3