Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Can lazy-list (and/or Elm) support tail call recursion? #5

Open
@naddeoa

Description

@naddeoa

Hey!

I've been using lazy-list a bunch and it's been great so far, thanks for the hard work!

I'm running into some stack overflow issues:

overflow : Int -> List Int
overflow n =
    Lazy.List.numbers
        |> Lazy.List.takeWhile (\number -> number < n)
        |> Lazy.List.toList

Calling it in a view for example:

((overflow 100000)
    |> toString
    |> Html.text
)

I've read online that Elm actually does tail call optimizations. I can see from my stack traces that my program dies in the LazyList code. Is it possible for the LazyList library to take advantage of tail call optimizations if Elm does in fact support it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions