From a66396651bea99ba81dbaf502e0da17d8c9f8bad Mon Sep 17 00:00:00 2001 From: Kyle Bashour Date: Wed, 20 Nov 2024 11:32:49 -0800 Subject: [PATCH] Make swift types public --- flake.lock | 6 +++--- src/Moat/Pretty/Swift.hs | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index a810dd6..d98d6b8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1697059129, - "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", + "lastModified": 1732014248, + "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", + "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "type": "github" }, "original": { diff --git a/src/Moat/Pretty/Swift.hs b/src/Moat/Pretty/Swift.hs index 9ec7038..7246938 100644 --- a/src/Moat/Pretty/Swift.hs +++ b/src/Moat/Pretty/Swift.hs @@ -34,7 +34,7 @@ prettySwiftDataWith :: prettySwiftDataWith indent = \case MoatEnum {..} -> prettyTypeDoc "" enumDoc [] - ++ "enum " + ++ "public enum " ++ prettyMoatTypeHeader enumName (addTyVarBounds enumTyVars enumProtocols) ++ prettyRawValueAndProtocols enumRawValue enumProtocols ++ " {" @@ -48,7 +48,7 @@ prettySwiftDataWith indent = \case ++ "}" MoatStruct {..} -> prettyTypeDoc "" structDoc [] - ++ "struct " + ++ "public struct " ++ prettyMoatTypeHeader structName (addTyVarBounds structTyVars structProtocols) ++ prettyRawValueAndProtocols Nothing structProtocols ++ " {" @@ -61,27 +61,27 @@ prettySwiftDataWith indent = \case ++ "}" MoatAlias {..} -> prettyTypeDoc "" aliasDoc [] - ++ "typealias " + ++ "public typealias " -- Swift aliases should not declare type parameters ++ prettyMoatTypeHeader aliasName [] ++ " = " ++ prettyMoatTypeBase aliasTyp MoatNewtype {..} -> prettyTypeDoc "" newtypeDoc [] - ++ "struct " + ++ "public struct " ++ prettyMoatTypeHeader newtypeName (addTyVarBounds newtypeTyVars newtypeProtocols) ++ prettyRawValueAndProtocols Nothing newtypeProtocols ++ " {\n" ++ indents ++ if isConcrete newtypeField then - "let " + "public let " ++ fieldName newtypeField ++ ": " ++ prettyMoatType (fieldType newtypeField) ++ "\n}" else - "typealias " + "public typealias " ++ newtypeName ++ "Tag" ++ " = Tagged<" @@ -139,7 +139,7 @@ prettyTags indents = go "\n" ++ prettyTagDisambiguator tagDisambiguate indents tagName ++ indents - ++ "typealias " + ++ "public typealias " ++ tagName ++ " = Tagged<" ++ (if tagDisambiguate then tagName ++ "Tag" else tagParent) @@ -162,7 +162,7 @@ prettyTagDisambiguator disambiguate indents parent = if disambiguate then indents - ++ "enum " + ++ "public enum " ++ parent ++ "Tag { }\n" else "" @@ -267,7 +267,7 @@ prettyStructFields indents fields deprecatedFields = go fields deprecatedFieldsMap = Map.fromList deprecatedFields prettyField (Field fieldName fieldType _fieldDoc) = indents - ++ "var " + ++ "public var " ++ fieldName ++ ": " ++ prettyMoatType fieldType @@ -288,7 +288,7 @@ prettyStructFields indents fields deprecatedFields = go fields prettyNewtypeField :: String -> Field -> String -> String prettyNewtypeField indents (Field alias fieldType _) fieldName = indents - ++ "let " + ++ "public let " ++ alias ++ ": " ++ fieldName