Skip to content

Instantly share code, notes, and snippets.

@dionyziz
Created April 28, 2019 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dionyziz/623dbeb6cc28126d4908d3449a9d0e3f to your computer and use it in GitHub Desktop.
Save dionyziz/623dbeb6cc28126d4908d3449a9d0e3f to your computer and use it in GitHub Desktop.
23.hs:23:3: error:
• Couldn't match type ‘a’ with ‘a0’
‘a’ is a rigid type variable bound by
the type signature for:
rnd_select :: forall a. [a] -> Int -> IO [a]
at 23.hs:18:1-34
Expected type: IO [a]
Actual type: IO [a0]
• In a stmt of a 'do' block: return choice
In the expression:
do gen <- getStdGen
let (gen', choice) = (chooseN gen n xs)
setStdGen gen'
return choice
In an equation for ‘rnd_select’:
rnd_select xs n
= do gen <- getStdGen
let (gen', choice) = ...
setStdGen gen'
....
• Relevant bindings include
choice :: [a0] (bound at 23.hs:21:14)
xs :: [a] (bound at 23.hs:19:12)
rnd_select :: [a] -> Int -> IO [a] (bound at 23.hs:19:1)
|
23 | return choice
| ^^^^^^^^^^^^^
Failed, one module loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment