use a new interface, unit -> 'a option, for Gen.