I am trying to use random-extra to generate a set of unique integers, but I am doing something wrong. Probably a beginners mistake or misunderstanding of randomness in Elm, but I cannot figure it out.
The code I wrote is:
import Random exposing (…)
import Random.Set exposing (…)fillStack : Cmd Msg
fillStack =
Random.generate FillStack generateStackgenerateStack : Random.Generator (Set Int)
generateStack =
Random.Set.set 5 (int 1 15)
The compiler says:
– TYPE MISMATCH —
The 2nd argument to
generate
is not what I expect:112| Random.generate FillStack generateStack
^^^^^^^^^^^^^
ThisgenerateStack
value is a:Generator (Set Int)
But
generate
needs the 2nd argument to be:Generator (List Int)
I get the type mismatch, but have no idea how to solve it. I tried to sneak in a Set.toList somewhere, but that was not accepted.
Any help appreciated!