on master help sign in
Account for unit and tuples in `elm diff` algorithm
81e5c10Evan Czaplicki
builder/src/Deps/Diff.hs+12
@@ -176,6 +176,18 @@ diffType oldType newType =
176 (Just oldExt, Just newExt) ->
176 (Just oldExt, Just newExt) ->
177 (:) (oldExt, newExt) <$> diffFields fields fields'
177 (:) (oldExt, newExt) <$> diffFields fields fields'
178
178
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+
179 (_, _) ->
191 (_, _) ->
180 Nothing
192 Nothing
181
193