当たり前といったら当たり前だけど、guardがきちんと動いた。

#light

open Seq

type SeqBuilder () =
 member b.Return a = singleton a
 member b.Bind (m, k) = map_concat k m
 member b.Let (x, f) = f x

let seq = SeqBuilder ()

let guard = function
 | true -> singleton ()
 | _ -> empty

let _ =
 seq { let! x = {1..10}  (* from *)
    do! guard (x > 5) (* where *)
    return (x * x) }  (* select *)
 |> iter (string_of_int >> print_endline)

(実行結果)
36
49
64
81
100