Skip to content

Instantly share code, notes, and snippets.

@ccapndave
Created May 7, 2017 07:57
Show Gist options
  • Save ccapndave/5d35786e182e830ad197ce0a315bc9bc to your computer and use it in GitHub Desktop.
Save ccapndave/5d35786e182e830ad197ce0a315bc9bc to your computer and use it in GitHub Desktop.
chooseHorse :: (RandomGen g) => g -> (Horse, g)
chooseHorse gen =
let
(rand, nextGen) =
random gen :: (Float, g)
-- Just choose any horse for the moment
horse =
horses !! 0
in
(horse, nextGen)
{-
• Couldn't match type ‘g’ with ‘g1’
‘g’ is a rigid type variable bound by
the type signature for:
chooseHorse :: forall g. RandomGen g => g -> (Horse, g)
at src/GrandNational.hs:20:16
‘g1’ is a rigid type variable bound by
an expression type signature:
forall g1. (Float, g1)
at src/GrandNational.hs:24:21
Expected type: (Float, g1)
Actual type: (Float, g)
• In the expression: random gen :: (Float, g)
In a pattern binding: (rand, nextGen) = random gen :: (Float, g)
In the expression:
let
(rand, nextGen) = random gen :: (Float, g)
horse = horses !! 0
in (horse, nextGen)
• Relevant bindings include
gen :: g (bound at src/GrandNational.hs:21:13)
chooseHorse :: g -> (Horse, g) (bound at src/GrandNational.hs:21:1)
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment