Skip to content

Instantly share code, notes, and snippets.

View jonathanjouty's full-sized avatar

Jonathan Jouty jonathanjouty

View GitHub Profile
@jonathanjouty
jonathanjouty / gist:3086205
Created July 10, 2012 21:01 — forked from kowey/gist:2420144
Haskell GTK on 64 bit MacOS X

Notes

  • on lion (and snow leopard i suppose), make sure you are using a 64 bit install of ghc. Also, unless you are suggesting an edit to these directions, please go ask people on the relevant mailing list or wiki for help :)
  • Tested on Mac OS X 10.7.4, GHC 7.4.1, 64bit Haskell Platform 2012.2.0.0 (installer package) with Command Line Tools for XCode (June 2012).
  • These notes were originally brought to you by Carter Schonwald; the “I” probably refers to him. Eric Kow will refer to himself in the third person).
  • Forked from kowey (Eric Kow): https://gist.github.com/2420144

Steps

@jonathanjouty
jonathanjouty / testRnd.hs
Created March 6, 2012 19:11
Shouldn't this be what you need?
import System.Random
-- Test validity of function on a given number of random tests.
testRandom :: Random a => StdGen -> Int -> (a -> Bool) -> Bool
testRandom gen n f = all f generated
where generated = take n $ randoms gen
-- Examples of use in GHCi:
-- r <- getStdGen
-- testRandom r 100 ((\a -> a==a) :: Int -> Bool)