 extension JSON : Hashable {
     public var hashValue: Int {
         switch self {
-        case .Error(let m):     fatalError(m)
+        case .Error(let m):     fatalError("\(m)")
         case .Null:             return NSNull().hashValue
         case .Bool(let v):      return v.hashValue
         case .Number(let v):    return v.hashValue

        get {
            switch self {
            case .Object(let o):
                return o[key] ?? .Error("subscript \"\(key)\" is nonexistent")
            default:
                return .Error("\"\(self)\" is not an object")
            }
        }
        set {

import Foundation

public enum JSON:Equatable {
    public enum JSONError : Equatable {
        case notAJSONObject
        case typeMismatch(JSON.ContentType)
        case indexOutOfRange(JSON.Index)
        case keyNonexistent(JSON.Key)
        case nsError(NSError)
    }
    public typealias Key        = String
    public typealias Value      = JSON
    public typealias Index      = Int
    case Error(JSONError)
    case Null
    case Bool(Bool)
    case Number(Double)
