Created
April 30, 2014 23:02
-
-
Save ovatsus/13f1e5ba1553a79224af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Html = | |
type HtmlNode = | |
| HtmlElement of name:string * attribute:HtmlAttribute list | |
| HtmlText of content:string *parent:HtmlNode | |
and HtmlAttribute = | |
| HtmlAttribute of name:string * value:string * parent:HtmlNode | |
let createElement name attrs = | |
let toAttributes element = [ for name, value in attrs -> HtmlAttribute(name, value, element)] | |
let rec element = HtmlElement(name, attributes) | |
and attributes = toAttributes element | |
element |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gives the error
Recursive values cannot appear directly as a construction of the type 'HtmlNode' within a recursive binding. This feature has been removed from the F# language. Consider using a record instead.