Started as JSON parser but can be applied as general Parser and Combinator. I will rewrite this.
1. newtype StateT s m a = StateT { runState :: s -> m a } and typealias; type ParserT a = StateT String Maybe a
2. Functor, Applicative, Monad, Traversable and Monoid instances of StateT.
1. Applying Generic Swift pattern; struct StateT<S,A> {..}
2. Protocols provide aletrnative to TypeClass; protocol Functor {..} etc.
import ParSwift
let jsonStr = "[{\"key1\":\"12\",\"key2\":[{\"key3\":true,\"key4\":null}]}]"
/// There are other general combinators also.
let parsed = ParSwift().combinator.jsonParser.runStateT(jsonStr)