on master help sign in
Account for unit and tuples in `elm diff` algorithm
commit81e5c1043ac8a3e7b54633440d3a0fc9942af653 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 2 Mar 2018, 16:42 (9 years ago) parent69b783f
1 file changed+12
builder/src/Deps/Diff.hs+12
builder/src/Deps/Diff.hs+12
@@ -176,6 +176,18 @@ diffType oldType newType =
176176 (Just oldExt, Just newExt) ->
177177 (:) (oldExt, newExt) <$> diffFields fields fields'
178178
179+ (Type.Unit, Type.Unit) ->
180+ Just []
181+
182+ (Type.Tuple a b cs, Type.Tuple x y zs) ->
183+ if length cs /= length zs then
184+ Nothing
185+ else
186+ do aVars <- diffType a x
187+ bVars <- diffType b y
188+ cVars <- concat <$> zipWithM diffType cs zs
189+ return (aVars ++ bVars ++ cVars)
190+
179191 (_, _) ->
180192 Nothing
181193