Brent Yorgey writes:
Your problem seems to be the type you have given to modelT: it claims
that it will work for *any* type g but this is not so; g must
represent a pseudorandom number generator. This works:
D'oh! A dumb mistake on my part. Thank you, Brent.