         throw NSError(domain: CRMappingDomain, code: -1, userInfo: userInfo)
     }
 }
+
+


// TODO: Maybe we can just make Optional: Mappable and then this redudancy can safely go away...
public func mapField<T: Mappable, U: Mapping, C: MappingContext where U.MappedObject == T>(inout field: T?, map:(key: KeyExtensions<U>, context: C)) -> C {
    
    guard map.context.error == nil else {
        return map.context

// NOTE: Must supply two separate versions for optional and non-optional types or we'll have to continuously
// guard against unsafe nil assignments.

public func <- <T: JSONable, U: Transform, C: MappingContext where U.MappedObject == T, T == T.ConversionType, T: AnyMappable>(inout field: T?, map:(key: KeyExtensions<U>, context: C)) -> C {
    print("reached")
    return mapField(&field, map: map)
}

public func <- <T: JSONable, C: MappingContext where T == T.ConversionType >(inout field: T?, map:(key: JSONKeypath, context: C)) -> C {
    return mapField(&field, map: map)
}

public func <- <T: Mappable, U: Mapping, C: MappingContext where U.MappedObject == T>(inout field: T?, map:(key: KeyExtensions<U>, context: C)) -> C {
    return mapField(&field, map: map)
}

public typealias MappableAndJSONable = protocol<JSONable, Mappable>


// MARK: - Map funcs

