compiler
compiler copied to clipboard
calling function recursively with different type arguments
When calling a function recursively, you can only call it with the same type arguments.
recursive : any -> Never
recursive _ =
recursive "specific"
We try to define a recursive function (infinite to make it simpler). When we call the recursive function with a specific type argument, elm complains:
The 1st argument to `recursive` is not what I expect: 2| recursive "specific" ^^^^^^^^^^ This argument is a string of type: String But `recursive` needs the 1st argument to be: any
In short, support polymorphic recursion.
- Elm 0.19.1
- Operating System: Ubuntu 20.04.2 LTS
Thanks for reporting this! To set expectations:
- Issues are reviewed in batches, so it can take some time to get a response.
- Ask questions in a community forum. You will get an answer quicker that way!
- If you experience something similar, open a new issue. We like duplicates.
Finally, please be patient with the core team. They are trying their best with limited resources.
same as https://github.com/elm/compiler/issues/2275 More detail in https://github.com/elm/compiler/issues/1964