Skip to content

Commit

Permalink
Reduce noise from diff
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSStewart committed Feb 18, 2024
1 parent f2d4d43 commit 88479e4
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions extra/Lamdera/Evergreen/MigrationGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -665,11 +665,11 @@ canAliasToMigration oldVersion newVersion scope interfaces recursionSet (typeNew
usageParamMigrationFns :: [Text]
usageParamMigrationFns = usageParamMigrations & fmap migrationFn

tvarsNew :: [N.Name]
tvarsNew = tvarMapNew & fmap fst
tvarsNew :: [Text]
tvarsNew = tvarMapNew & fmap (N.toText . fst)

tvarsOld :: [N.Name]
tvarsOld = tvarMapOldReplaced & fmap fst
tvarsOld :: [Text]
tvarsOld = tvarMapOldReplaced & fmap (N.toText . fst)

(MigrationNested migrationAliasedType imps subDefs) =
let
Expand All @@ -685,19 +685,17 @@ canAliasToMigration oldVersion newVersion scope interfaces recursionSet (typeNew
migrationName :: Text
migrationName = migrationNameUnderscored newModule oldVersion newVersion typeNameNew

paramMigrationPairs :: [(N.Name, N.Name)]
paramMigrationPairs =
zip tvarsOld tvarsNew
paramMigrationPairs = zip tvarsOld tvarsNew

paramMigrationFnsTypeSig :: [Text]
paramMigrationFnsTypeSig =
paramMigrationPairs
& fmap (\(oldT, newT) -> T.concat [ "(", N.toText oldT, "_old -> ", N.toText newT, "_new)" ] )
& fmap (\(oldT, newT) -> T.concat [ "(", oldT, "_old -> ", newT, "_new)" ] )

paramMigrationVars :: Text
paramMigrationVars =
paramMigrationPairs
& fmap (\(oldT, newT) -> T.concat [ "migrate_", N.toText oldT ] )
& fmap (\(oldT, newT) -> T.concat [ "migrate_", oldT ] )
& T.intercalate " "

oldType = T.concat [moduleNameOld & dropCan & N.toText, ".", typeNameOld & N.toText]
Expand All @@ -707,9 +705,9 @@ canAliasToMigration oldVersion newVersion scope interfaces recursionSet (typeNew
migrationTypeSignature = T.concat
[ paramMigrationFnsTypeSig & T.intercalate " -> " & suffixIfNonempty " -> "
, " " , oldType , " "
, tvarsOld & fmap (\tvar -> T.concat [N.toText tvar, "_old"]) & T.intercalate " "
, tvarsOld & fmap (\tvar -> T.concat [tvar, "_old"]) & T.intercalate " "
, " -> " , newType , " "
, tvarsNew & fmap (\tvar -> T.concat [N.toText tvar, "_new"]) & T.intercalate " "
, tvarsNew & fmap (\tvar -> T.concat [tvar, "_new"]) & T.intercalate " "
]

applyOldValueIfNotRecord m =
Expand Down

0 comments on commit 88479e4

Please sign in to comment.