I have a function shufflefor Array:
shuffle:: forall e. Array -> Eff (random :: RANDOM | e) Array
Shuffles the array in the monad Control.Monad.Eff.Randomand returns wrapped. I want to check that the array is shuffled, as for comparison, the result is different, so I am writing QuickCheck code, for example:
quickCheck \arr -> isShuffled (shuffle arr)
However, I'm not sure how to write isShuffledto match type definitions. As:
There is no function expansion as fromJustin Maybe, so it must accept Random Arrayand return Random Boolean, while I put the verification code in a monadic expression.
Consequently, the result isShuffledwill not be simple Boolean, but howm Boolean
There is no suitable Testablein purescript-quickcheckfor m Boolean, so I may need to create one instance for it, while a comment in QuickCheck relates:
A testable property is a function of zero or more Arbitrary arguments, returning a Boolean or Result.( code )
However, again, I cannot extract / expand the value from the Randommonad, I don’t know how to access the Boolean inside it and implement how testableRandomArrayto, Booleanor Resultfrom Random Boolean, if I do not use some unsafe functions.
I think I need to “insert” a string quickCheckinside the random monad so that I can access the clean arrays that it shuffled. However, since it quickCheckgenerates test devices, I feel that it is strange and has nothing to do with it.