(* primes.sig *) (* generation of primes *) signature PRIMES = sig (* the following sequence of declarations produces all the primes: val (pr1, st) = next init val (pr2, st) = next st val (pr3, st) = next st ... *) type state val init : state (* initial state *) val next : state -> int * state (* state transition, yielding prime *) end;