Library
Module
Module type
Parameter
Class
Class type
Predefined bibtex fields and helper functions.
include Field_types.self
Talaria-bibtex exposes its own orec
namespace
include Orec.Namespace.S
type 'info get = (('a, 'mut) Orec.Type_data.getter * 'res) field_action constraint 'info = < x : 'a ; mut : 'mut ; ret : 'res >
Aliases for the field types
type 'a field = < x : 'a ; mut : Orec.Type_data.imm ; ret : 'a option > get
type 'a mut_field = < x : 'a ; mut : Orec.Type_data.mut ; ret : 'a option > get
type 'a exn_field = < x : 'a ; mut : Orec.Type_data.imm ; ret : 'a > get
type 'a exn_mut_field = < x : 'a ; mut : Orec.Type_data.mut ; ret : 'a > get
type ('param, 't) update = ('param Orec.Type_data.updater * 't) field_action
val empty : t
The empty record
val create : (Orec.Type_data.only Orec.Type_data.const, t) update list -> t
Create a new open record from a list of field updater : create [ field1 ^= value1; field2 ^= value2; ... ]
Only const updater make sense in this context, since there is no fields present.
val new_field : unit -> 'ty field
Creation of a new fields. Note that the type 'ty is weakly polymorphic once the field created. However, in this specific use case, it seems reasonable to annotate the field type by using one of the field type aliases.
val new_field_mut : unit -> 'ty mut_field
val new_field_exn : unit -> 'ty exn_field
val new_field_exn_mut : unit -> 'ty exn_mut_field
val put : < x : 'ty.. > get -> 'ty -> (_ Orec.Type_data.const, t) update
Constant field updater: record.%{ field ^= v }
sets the value of field
to v
and is equivalent to record.%{ put field v }
val (^=) : < x : 'ty.. > get -> 'ty -> (_ Orec.Type_data.const, t) update
val fmap :
< x : 'ty.. > get ->
('ty -> 'ty) ->
('a Orec.Type_data.fn, t) update
Field map: record.%{field |= f }
or record.%{ fmap field f }
are equivalent to record.%{ field ^= f record.%{field} }
if the field exists, and do nothing otherwise
val (|=) :
< x : 'ty.. > get ->
('ty -> 'ty) ->
('a Orec.Type_data.fn, t) update
Field combinator orec.%{ x & y }
is orec.%{x}.%{y}
val (&) :
(Orec.Type_data.any, t) update ->
(Orec.Type_data.any, t) update ->
(Orec.Type_data.any, t) update
val and_then :
(Orec.Type_data.any, t) update ->
(Orec.Type_data.any, t) update ->
(Orec.Type_data.any, t) update
val copy :
< x : 'ty ; mut : Orec.Type_data.mut.. > get ->
('a Orec.Type_data.fn, t) update
Copy a mutable field
val delete : < .. > get -> ('a Orec.Type_data.del, t) update
Delete a field, if the field does not exist, do nothing
val update : (Orec.Type_data.any, t) update -> t -> t
val set : < x : 'ty ; mut : Orec.Type_data.mut.. > get -> 'ty -> t -> unit
Operator version of get+update and set
val (.%{}) : t -> (_ * 'ret) field_action -> 'ret
(.%{} )
operator:
record.%{field}
returns the value of the fieldrecord.%{field ^= value}
returns a functional update of record record.%{field |= f}
is equivalent to record.{ field ^= f record.{field} }
record.%{delete field}
returns an updated version of record without this fieldval (.%{}<-) : t -> < x : 'ty ; mut : Orec.Type_data.mut.. > get -> 'ty -> unit
val transmute :
< x : 'a ; mut : 'm.. > as 'x get ->
('a, 'b) bijection ->
< x : 'b ; mut : 'm ; ret : 'b option > get
Use the type equality implied by the bijection 'a⟺'b
to create a new 'b
field getter from an 'a
field getter. The new field getter uses option access
val (@:) :
< x : 'a ; mut : 'm.. > as 'x get ->
('a, 'b) bijection ->
< x : 'b ; mut : 'm ; ret : 'b option > get
Operator version of transmute
A bibtex field consists of an orec
field, a name and a translation between the raw text of the field towards a typed field
The exception Unknown_attribute
is raised whenever a type dkey fails to parse its contents to its underlying type.
val str : 'a named_field -> string field
Create a string view from a named_field
val named_field : name:string -> ('a, string) bijection -> 'a named_field
Field creation helper
val str_field : name:string -> string named_field
val int_field : name:string -> int named_field
val strset_field : name:string -> StrSet.t named_field
val uid : string named_field
val kind : kind named_field
val title : string named_field
val authors : name list named_field
val year : int named_field
val journal : string named_field
val booktitle : string named_field
val volume : int named_field
val number : int named_field
val pages : pages named_field
val doi : string list named_field
val arxiv : string named_field
val tags : StrSet.t named_field
val src : StrSet.t named_field
val state : state named_field
val abstract : string named_field
val location : string named_field
val conference : string named_field
val raw : string Database.t field
val default_keys : string field Database.t
The default typed keys when parsing bibtex file
type entry = t
Type alias
type data = entry Database.t
Raw database and entries
val check : ?with_keys:string field Database.t -> raw_entry Database.t -> data