cabal install ランダムエクストラ
Prelude Data.Random.Extras> import Data.Random.Extras
Prelude Data.Random.Extras> let s = shuffle "somestring"
Prelude Data.Random.Extras> s
<interactive>:1:1:
No instance for (Show (Data.RVar.RVar [Char]))
arising from a use of `print'
Possible fix:
add an instance declaration for (Show (Data.RVar.RVar [Char]))
In a stmt of an interactive GHCi command: print it
Data.RVar.RVar [Char] を [Char] に変換するにはどうすればよいですか?
更新しました:
Data.Random.Source.DevRandom をインポートできません:
Prelude> import Data.Random hiding (shuffle)
Prelude Data.Random> import Data.Random.Source.DevRandom
<no location info>:
Could not find module `Data.Random.Source.DevRandom':
Use -v to see a list of the files searched for.
しかし:
[59]: cabal install random-fu
Resolving dependencies...
No packages to be installed. All the requested packages are already installed.
If you want to reinstall anyway then use the --reinstall flag.
[60]: cabal install random-source
Resolving dependencies...
No packages to be installed. All the requested packages are already installed.
If you want to reinstall anyway then use the --reinstall flag.
更新 2:
*Main System.Random> import Data.Random hiding (shuffle)
*Main System.Random Data.Random> import Data.Random.Source.Std
*Main System.Random Data.Random Data.Random.Source.Std> import Data.Random.Extras
*Main System.Random Data.Random Data.Random.Source.Std Data.Random.Extras> let reversed = runRVar (shuffle "somestring") StdRandom
<interactive>:1:16:
Ambiguous type variable `m0' in the constraints:
(MonadRandom m0) arising from a use of `runRVar'
at <interactive>:1:16-22
(Monad m0) arising from a use of `runRVar' at <interactive>:1:16-22
Probable fix: add a type signature that fixes these type variable(s)
In the expression: runRVar (shuffle "somestring") StdRandom
In an equation for `reversed':
reversed = runRVar (shuffle "somestring") StdRandom