Skip to content

Fix stack overflow when operating on large lists #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/Debugger/Expando.elm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Elm.Kernel.Debugger
import Html exposing (Html, div, span, text)
import Html.Attributes exposing (class, style)
import Html.Events exposing (onClick)
import Json.Decode as Json



Expand Down Expand Up @@ -126,7 +125,7 @@ mergeHelp old new =
new

(Sequence _ isClosed oldValues, Sequence seqType _ newValues) ->
Sequence seqType isClosed (mergeListHelp oldValues newValues)
Sequence seqType isClosed (mergeListHelp oldValues newValues [])

(Dictionary isClosed _, Dictionary _ keyValuePairs) ->
Dictionary isClosed keyValuePairs
Expand All @@ -135,23 +134,23 @@ mergeHelp old new =
Record isClosed <| Dict.map (mergeDictHelp oldDict) newDict

(Constructor _ isClosed oldValues, Constructor maybeName _ newValues) ->
Constructor maybeName isClosed (mergeListHelp oldValues newValues)
Constructor maybeName isClosed (mergeListHelp oldValues newValues [])

_ ->
new


mergeListHelp : List Expando -> List Expando -> List Expando
mergeListHelp olds news =
mergeListHelp : List Expando -> List Expando -> List Expando -> List Expando
mergeListHelp olds news accumulator =
case (olds, news) of
([], _) ->
news
List.foldl (::) news accumulator

(_, []) ->
news
List.foldl (::) news accumulator

(x :: xs, y :: ys) ->
mergeHelp x y :: mergeListHelp xs ys
mergeListHelp xs ys (mergeHelp x y :: accumulator)


mergeDictHelp : Dict String Expando -> String -> Expando -> Expando
Expand Down