Created
February 11, 2012 19:57
-
-
Save mklinik/1803869 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Random | |
-- randomEnum :: (Enum a, Bounded a) => IO a | |
randomEnum = do | |
let minBoundInt = fromEnum (minBound::a) | |
let maxBoundInt = fromEnum (maxBound::a) | |
randomInt <- Random.randomRIO (minBoundInt, maxBoundInt) | |
return $ toEnum randomInt | |
Util.hs:15:31: | |
No instance for (Bounded a) | |
arising from a use of `minBound' | |
In the first argument of `fromEnum', namely `(minBound :: a)' | |
In the expression: fromEnum (minBound :: a) | |
In an equation for `minBoundInt': | |
minBoundInt = fromEnum (minBound :: a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment