where toJSON (Right (e, i)) = "{ \"Entities\": \"" ⧺ escape e
                              ⧺ "\", \"Interface\": \"" ⧺ escape i
                              ⧺ "\", " ⧺ ver ⧺ "\"}"
        toJSON (Left err) = "{ \"error\": \"" ⧺ escape err ⧺ "\", " ⧺ ver ⧺ "\"}"
        checkOrGen rawSpec = let errors = checkSpec rawSpec in
                             if null errors then Right (gen rawSpec)
                                            else Left errors
        gen = translator (swift False "Transport" "Interface") ∘ parse
        ver = "\"version\": \"" ⧺ showVersion version

config = defaultConfig { srvLog = stdLogger, srvPort = 9
toSwift = toJSON ∘ checkOrGen
  where toJSON (Right (e, i)) = "{ \"Entities\": \"" ⧺ escape e
                              ⧺ "\", \"Interface\": \"" ⧺ escape i
                              ⧺ "\", " ⧺ ver ⧺ "\"}"
        toJSON (Left err) = "{ \"error\": \"" ⧺ escape err ⧺ "\", " ⧺ ver ⧺ "\"}"
        checkOrGen rawSpec = let errors = checkSpec rawSpec in
                             if null errors then Right (gen rawSpec)
                                            else Left errors
        gen = translator (swift False "Transport" "Interface") ∘ parse
        ver = "\"version\": \"" ⧺ showVersion version
toSwift = toJSON ∘ checkOrGen
  where toJSON (Right (e, i)) = "{ \"Entities\": \"" ⧺ escape e
                              ⧺ "\", \"Interface\": \"" ⧺ escape i
                              ⧺ "\", " ⧺ ver ⧺ "\"}"
        toJSON (Left err) = "{ \"error\": \"" ⧺ escape err ⧺ "\", " ⧺ ver ⧺ "\"}"
        checkOrGen rawSpec = let errors = checkSpec rawSpec in
                             if null errors then Right (gen rawSpec)
                                            else Left errors
        gen = translator (swift False "Transport" "Interface") ∘ parse
        ver = "\"version\": \"" ⧺ showVersion version