Skip to content

Commit

Permalink
Fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Jul 11, 2023
1 parent 35db578 commit f5037c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion essence-of-live-coding/src/LiveCoding/Migrate.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ matchingAlgebraicDataTypes :: (Data a, Data b) => a -> b -> Bool
matchingAlgebraicDataTypes a b
= isAlgType typeA
&& isAlgType typeB
&& dataTypeName typeA == dataTypeName typeB
&& withoutModule (dataTypeName typeA) == withoutModule (dataTypeName typeB)
where
typeA = dataTypeOf a
typeB = dataTypeOf b
withoutModule string = let
(prefix, suffix) = break (== '.') string
in if null suffix then prefix else withoutModule $ tail suffix
-- | Assuming that both are algebraic data types, possibly the constructor names match.
-- In that case, we will try and recursively migrate as much data as possible onto the new constructor.
Expand Down

0 comments on commit f5037c3

Please sign in to comment.