Moved to repository: https://github.com/Mailcloud/swift-serializer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code accompanies a blog post: http://chris.eidhof.nl/posts/json-parsing-in-swift.html | |
| // | |
| // As of Beta5, the >>= operator is already defined, so I changed it to >>>= | |
| import Foundation | |
| let parsedJSON : [String:AnyObject] = [ | |
| "stat": "ok", | |
| "blogs": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // F#'s "pipe-forward" |> operator | |
| // | |
| // Also "Optional-chaining" operators |>! and |>& | |
| // | |
| // And adapters for standard library map/filter/sorted | |
| infix operator |> { precedence 50 associativity left } | |
| infix operator |>! { precedence 50 associativity left } | |
| infix operator |>& { precedence 50 associativity left } | |
| infix operator |>* { precedence 50 associativity left } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol Num { | |
| class func zero() -> Self | |
| func succ() -> Self | |
| func add(y: Self) -> Self | |
| func multiply(y: Self) -> Self | |
| } | |
| extension Int32: Num { | |
| static func zero() -> Int32 { return 0 } | |
| func succ() -> Int32 { return self + 1 } |
NewerOlder