Skip to content

Instantly share code, notes, and snippets.

@ovatsus
Created April 30, 2014 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ovatsus/13f1e5ba1553a79224af to your computer and use it in GitHub Desktop.
Save ovatsus/13f1e5ba1553a79224af to your computer and use it in GitHub Desktop.
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
@ovatsus
Copy link
Author

ovatsus commented Apr 30, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment