messagetemplates / messagetemplates-fsharp

Message templates - the ability to format named string values, and capture the properties
http://messagetemplates.org/
Apache License 2.0
18 stars 4 forks source link

Create a single-file F# implementation #5

Closed adamchester closed 9 years ago

adamchester commented 9 years ago

It should have the following capabilities, in order of importance to me:

The API might look like this:

/// Formats a message template as a string, replacing the properties
/// with the provided values, writing to results to a TextWriter.
val formatf: provider: System.IFormatProvider
            -> tw: System.IO.TextWriter
            -> template: Template
            -> values: obj[]
            -> unit

/// Formats a message template as a string, replacing the properties
/// with the provided values.
val formats: provider: System.IFormatProvider
            -> template: Template
            -> values: obj[]
            -> string

/// Captures the properties f
val captureProperties: messageTemplate:Template -> (PropertyData * obj) seq

/// Parses a message template string.
val parse: templateString:string -> Template

It should be easy to simply copy the file into a project and use it.

It should be fast.

adamchester commented 9 years ago

Done

nblumhardt commented 9 years ago

Bravo :-)