Skip to content

Instantly share code, notes, and snippets.

@devhawk
Created August 4, 2016 17:18
Show Gist options
  • Select an option

  • Save devhawk/738bd16986018a1307e7f6750c608c5e to your computer and use it in GitHub Desktop.

Select an option

Save devhawk/738bd16986018a1307e7f6750c608c5e to your computer and use it in GitHub Desktop.
F# Indent
open System
// helper function to indent an indexedTextWriter and automatically un-indent
// when disposed
let indent (itw : System.CodeDom.Compiler.IndentedTextWriter) =
let current = itw.Indent
itw.Indent <- current + 1
{ new IDisposable with
member x.Dispose() = itw.Indent <- current }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment