Skip to content

Commit

Permalink
Add translate-from-context get function
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorNicollet committed May 13, 2012
1 parent a5b076e commit e9b8e5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/adLib.ml
Expand Up @@ -7,6 +7,8 @@ class ['key] ctx (source : 'key source) = object
method adlib = adlib
end

let get key =
Run.map (fun ctx -> ctx # adlib key) Run.context

let (!!) fmt = Printf.sprintf fmt
let const x _ = x
Expand Down
3 changes: 3 additions & 0 deletions src/adLib.mli
Expand Up @@ -22,6 +22,9 @@ class ['key] ctx : 'key source -> object
method adlib : 'key source
end

(** Extract a source from the context and grab a key out of it. *)
val get : 'key -> ('key # ctx, string) Run.t

(** {2 Utilities} *)

(** Alias for [Printf.sprintf]. *)
Expand Down

0 comments on commit e9b8e5e

Please sign in to comment.