Skip to content

Fix incorrect use of :: vs ++ in editListNested (version 3.0.1) #49

@decioferreira

Description

@decioferreira

We found that in editListNested, the code currently uses :: where ++ is required (this was found as part of the investigation for guida-lang/compiler#111):

diff --git a/src/Mark/Edit.elm b/src/Mark/Edit.elm
index 0df7c1f..1b6f9fb 100644
--- a/src/Mark/Edit.elm
+++ b/src/Mark/Edit.elm
@@ -815,7 +815,7 @@ editListNested cursor lsNested =
 
                             EditMade maybeSeed maybePush newChild ->
                                 ( EditMade maybeSeed maybePush []
-                                , newChild :: pastChildren
+                                , newChild ++ pastChildren
                                 )
             )
             ( NoIdFound, [] )

This compiles in Elm either way, but only the ++ version seems correct.
The Guida compiler seems to correctly enforce this, and only accepts the ++ version.

Suggestion: Apply this diff and publish a new patch release, so that it could be used on Guida projects.

I suspect this may also cause subtle issues when running on Elm, but I haven’t been able to verify it yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions