       }
     }
   }
-
-  public var description: Swift.String {
-    switch self {
-    case .Null:
-      return "Null"
+}
+
+extension Yaml {
+  public var bool: Swift.Bool? {
+    switch self {
     case .Bool(let b):
-      return "Bool(\(b))"
+      return b
+    default:
+      return nil
+    }
+  }
+
+  public var int: Swift.Int? {
+    switch self {
     case .Int(let i):
-      return "Int(\(i))"
+      return i
     case .Double(let f):
-      return "Double(\(f))"
+      if Swift.Double(Swift.Int(f)) == f {
+        return Swift.Int(f)
+      } else {
+        return nil
+      }
+    default:
+      return nil
+    }
+  }
+
+  public var double: Swift.Double? {
+    switch self {
+    case .Double(let f):
+      return f
+    case .Int(let i):
+      return Swift.Double(i)
+    default:
+      return nil
+    }
+  }
+
+  public var string: Swift.String? {
+    switch self {
     case .String(let s):
-      return "String(\(s))"
-    case .Array(let s):
-      return "Array(\(s))"
-    case .Dictionary(let m):
-      return "Dictionary(\(m))"
-    case .Invalid(let e):
-      return "Invalid(\(e))"
-    }
-  }
-
-  public var hashValue: Swift.Int {
-    return description.hashValue
+      return s
+    default:
+      return nil
+    }
+  }
+
+  public var array: [Yaml]? {
+    switch self {
+    case .Array(let array):
+      return array
+    default:
+      return nil
+    }
+  }
+
+  public var dictionary: [Yaml: Yaml]? {
+    switch self {
+    case .Dictionary(let dictionary):
+      return dictionary
+    default:
+      return nil
+    }
+  }
+
+  public var count: Swift.Int? {
+    switch self {
+    case .Array(let array):
+      return array.count
+    case .Dictionary(let dictionary):
+      return dictionary.count
+    default:
+      return nil
+    }
+  }
+
+  public var isValid: Swift.Bool {
+    switch self {
+    case .Invalid:
+      return false
+    default:
+      return true
+    }
   }
 }
 

    }
    return docs
  }

  public var bool: Swift.Bool? {
    switch self {
    case .Bool(let b):
      return b
    default:
      return nil
    }
  }

  public var int: Swift.Int? {
    switch self {
    case .Int(let i):
      return i
    case .Double(let f):
      if Swift.Double(Swift.Int(f)) == f {
        return Swift.Int(f)
      } else {
        return nil
      }
    default:
      return nil
    }
  }

  public var double: Swift.Double? {
    switch self {
    case .Double(let f):
      return f
    case .Int(let i):
      return Swift.Double(i)
    default:
      return nil
    }
  }

  public var string: Swift.String? {
    switch self {
    case .String(let s):
      return s
    default:
      return nil
    }
  }

  public var array: [Yaml]? {
    switch self {
    case .Array(let array):
      return array
    default:
      return nil
    }
  }

  public var dictionary: [Yaml: Yaml]? {
    switch self {
    case .Dictionary(let dictionary):
      return dictionary
    default:
      return nil
    }
  }

  public var count: Swift.Int? {
    switch self {
    case .Array(let array):
      return array.count
    case .Dictionary(let dictionary):
      return dictionary.count
    default:
      return nil
    }
  }

  public var isValid: Swift.Bool {
    switch self {
    case .Invalid:
      return false
    default:
      return true
    }
  }

  public subscript(index: Swift.Int) -> Yaml {
    get {
      assert(index >= 0)

  case Array([Yaml])
  case Dictionary([Yaml: Yaml])
  case Invalid(Swift.String)
}

extension Yaml: NilLiteralConvertible {
  public init(nilLiteral: ()) {
    self = .Null
  }
}

extension Yaml: BooleanLiteralConvertible {
  public init(booleanLiteral: BooleanLiteralType) {
    self = .Bool(booleanLiteral)
  }
}

extension Yaml: IntegerLiteralConvertible {
  public init(integerLiteral: IntegerLiteralType) {
    self = .Int(integerLiteral)
  }
}

extension Yaml: FloatLiteralConvertible {
  public init(floatLiteral: FloatLiteralType) {
    self = .Double(floatLiteral)
  }
}

extension Yaml: StringLiteralConvertible {
  public init(stringLiteral: StringLiteralType) {
    self = .String(stringLiteral)
  }
