# HG changeset patch # User haftmann # Date 1194351169 -3600 # Node ID fc01c83a466d2ceccd07a72a0bb6d7c410f74178 # Parent 389902f0a0c81b1bab9095b64436eaf84c7c1d46 added explicit signature diff -r 389902f0a0c8 -r fc01c83a466d src/HOL/Tools/dseq.ML --- a/src/HOL/Tools/dseq.ML Tue Nov 06 13:12:48 2007 +0100 +++ b/src/HOL/Tools/dseq.ML Tue Nov 06 13:12:49 2007 +0100 @@ -5,9 +5,27 @@ Sequences with recursion depth limit. *) -structure DSeq = +signature DSEQ = +sig + type 'a seq = int -> 'a Seq.seq; + val maps: ('a -> 'b seq) -> 'a seq -> 'b seq + val map: ('a -> 'b) -> 'a seq -> 'b seq + val append: 'a seq -> 'a seq -> 'a seq + val interleave: 'a seq -> 'a seq -> 'a seq + val single: 'a -> 'a seq + val empty: 'a seq + val guard: bool -> unit seq + val of_list: 'a list -> 'a seq + val list_of: 'a seq -> 'a list + val pull: 'a seq -> ('a * 'a seq) option + val hd: 'a seq -> 'a +end; + +structure DSeq : DSEQ = struct +type 'a seq = int -> 'a Seq.seq; + fun maps f s 0 = Seq.empty | maps f s i = Seq.maps (fn a => f a i) (s (i - 1)); @@ -27,7 +45,7 @@ fun list_of s = Seq.list_of (s ~1); -fun pull s = Seq.pull (s ~1); +fun pull s = Seq.pull (s ~1) |> (Option.map o apsnd) K; (*FIXME*) fun hd s = Seq.hd (s ~1);