[ create a new paste ] login | about

Link: http://codepad.org/8hIGzxdP    [ raw code | fork ]

OCaml, pasted on Nov 1:
module Sqlexpr : sig
  type st
  type ('a, 'b) directive = (st -> 'b) -> st -> 'a
 
  module Directives :
  sig
    val literal : string -> ('a, 'a) directive
    val text : (string -> 'a, 'a) directive
  end

  type stmt_cache
  type ('a, 'b) statement =
      {
        sql_statement : string;
        stmt_cache : stmt_cache option;
        directive : ('a, 'b) directive;
      }
  val make_cache : unit -> stmt_cache
end = struct

  type st = int
  type ('a, 'b) directive = (st -> 'b) -> st -> 'a

  module Directives = struct
    let literal s f x = assert false 
    let text f x = assert false
  end

  type stmt_cache = int
  let make_cache () = 0
  type ('a, 'b) statement =
      {
        sql_statement : string;
        stmt_cache : stmt_cache option;
        directive : ('a, 'b) directive;
      }
end
 
 
let _ = ignore (Sqlexpr.make_cache ())

let stmt =
(*   let cache = Some (Sqlexpr.make_cache ()) in *)
  let cache = None in
    {
      Sqlexpr.sql_statement = "DELETE FROM users WHERE login = ?";
      stmt_cache = cache;
      directive =
        (fun __pa_sql_6 __pa_sql_7 ->
           Sqlexpr.Directives.literal "DELETE FROM users WHERE login = "
             (Sqlexpr.Directives.text __pa_sql_6) __pa_sql_7);
    }
 
let stmt2 =
  let cache = None in
    {
      Sqlexpr.sql_statement = "DELETE FROM users WHERE login = ?";
      stmt_cache = cache;
      directive =
        (fun __pa_sql_6 __pa_sql_7 ->
           Sqlexpr.Directives.literal "DELETE FROM users WHERE login = "
             (Sqlexpr.Directives.text __pa_sql_6) __pa_sql_7);
    }


Output:
No errors or program output.


Create a new paste based on this one


Comments: