let id = blogDict["id"] as NSNumber? { if let name = blogDict["name"] as NSString? { if let needsPassword = blogDict["needspassword"] as NSNumber? { if let url = blogDict["url"] as NSString? { return Blog(id: id.integerValue, name: name, needsPassword: needsPassword.boolValue, url: NSURL(string: url) ) } } } } return nil }
id = blogDict["id"] as NSNumber? { if let name = string(blogDict, "name") { if let needsPassword = blogDict["needspassword"] as NSNumber? { if let url = string(blogDict, "url") { return Blog(id: id.integerValue, name: name, needsPassword: needsPassword.boolValue, url: NSURL(string: url) ) } } } } return nil }
Bool -> NSURL -> Blog let makeBlog = curry(blog) // Has type: Int? let id = int(blogData, "id") // Has type: (String -> Bool -> NSURL -> Blog)? let step1 = apply(makeBlog,id)
NSURL -> Blog)? let step1 = apply(makeBlog,id) // Has type: String? let name = string(blogData,"name") // Has type: (Bool -> NSURL -> Blog)? let step2 = apply(step1,name)
= blogDict["id"] as NSNumber? { if let name = blogDict["name"] as NSString? { if let needsPassword = blogDict["needspassword"] as NSNumber? { if let url = blogDict["url"] as NSString? { return Blog(id: id.integerValue, name: name, needsPassword: needsPassword.boolValue, url: NSURL(string: url) ) } } } } return nil }