Skip to content

Conversation

MartinSStewart
Copy link
Member

@MartinSStewart MartinSStewart commented Feb 18, 2024

For types such as type Id a = Id String previously the following would get generated

migrate_Migrate_All_New_Id : (a_old -> a_new) -> Migrate_All.Old.Id a_old -> Migrate_All.New.Id a_new
migrate_Migrate_All_New_Id migrate_a old =
    case old of
        Migrate_All.Old.Id p0 ->
            Migrate_All.New.Id p0

With this PR, it will instead generate

migrate_Migrate_All_New_Id : Migrate_All.Old.Id a_old -> Migrate_All.New.Id a_new
migrate_Migrate_All_New_Id old =
    case old of
        Migrate_All.Old.Id p0 ->
            Migrate_All.New.Id p0

Note that currently this does not handle aliases. So something like

type alias Point2d units coordinates = Point2dHelper units coordinates

type Point2dHelper units coordinates = Point2dHelper { x : Float, y : Float } 

will still generate migrations for Point2d's units and coordinates even though they are phantom types.

Copy link
Member

@supermario supermario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@supermario supermario merged commit 5116003 into lamdera-next Feb 18, 2024
@supermario supermario deleted the fix-phantom-types-migration branch February 18, 2024 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants