1 people like it.
Like the snippet!
Html dsl starters
following http://vimeo.com/groups/97577/videos/97315970 to make my own html DSL
1:
2:
3:
4:
5:
6:
|
module Html
let selfClosedTag name = sprintf "<%s/>" name
let contentTag name content = sprintf "<%s>%s</%s>" name content name
let emptyTag name= contentTag name System.String.Empty
let heading n content = sprintf "h%d" n |> contentTag <| content
heading 1 "Creating DSLs with F#"
|
module Html
val selfClosedTag : name:string -> string
Full name: Html.selfClosedTag
val name : string
val sprintf : format:Printf.StringFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val contentTag : name:string -> content:string -> string
Full name: Html.contentTag
val content : string
val emptyTag : name:string -> string
Full name: Html.emptyTag
namespace System
Multiple items
type String =
new : value:char -> string + 7 overloads
member Chars : int -> char
member Clone : unit -> obj
member CompareTo : value:obj -> int + 1 overload
member Contains : value:string -> bool
member CopyTo : sourceIndex:int * destination:char[] * destinationIndex:int * count:int -> unit
member EndsWith : value:string -> bool + 2 overloads
member Equals : obj:obj -> bool + 2 overloads
member GetEnumerator : unit -> CharEnumerator
member GetHashCode : unit -> int
...
Full name: System.String
--------------------
System.String(value: nativeptr<char>) : unit
System.String(value: nativeptr<sbyte>) : unit
System.String(value: char []) : unit
System.String(c: char, count: int) : unit
System.String(value: nativeptr<char>, startIndex: int, length: int) : unit
System.String(value: nativeptr<sbyte>, startIndex: int, length: int) : unit
System.String(value: char [], startIndex: int, length: int) : unit
System.String(value: nativeptr<sbyte>, startIndex: int, length: int, enc: System.Text.Encoding) : unit
field string.Empty
val heading : n:int -> content:string -> string
Full name: Html.heading
val n : int
More information