Stream: beginners

Topic: confusing error message


view this post on Zulip Nikolaus Wettstein (Jan 01 2023 at 22:40):

I get this confusing error message:

This 2nd argument to map has an unexpected type:

93│          |> List.map calcScore
                         ^^^^^^^^^

This calcScore value is a:

    Instruction -> Points

But map needs its 2nd argument to be:

    Instruction -> Points

view this post on Zulip Nikolaus Wettstein (Jan 01 2023 at 22:45):

How can I debug this error?

view this post on Zulip Brendan Hansknecht (Jan 01 2023 at 23:53):

Very strange. Can you share more context? Maybe a GitHub link or gist

view this post on Zulip Nikolaus Wettstein (Jan 02 2023 at 09:33):

https://gist.github.com/ni-ko-o-kin/3486d50bc5eac6d3e19f7d7da3fc8181

view this post on Zulip Nikolaus Wettstein (Jan 02 2023 at 09:35):

Compiler-Build is from 2022-01-01

view this post on Zulip Brendan Hansknecht (Jan 02 2023 at 17:16):

woah. This is a really weird manifestation of a small typo in your code. Roc is somehow missing a type error earlier in the code and progrogating that type error wrong. So definitely a bug in type checking.

view this post on Zulip Brendan Hansknecht (Jan 02 2023 at 17:16):

The actually error is here: https://gist.github.com/ni-ko-o-kin/3486d50bc5eac6d3e19f7d7da3fc8181#file-02-solution-part2-roc-L39

view this post on Zulip Brendan Hansknecht (Jan 02 2023 at 17:16):

should be toOutcome : Str -> Outcome

view this post on Zulip Brendan Hansknecht (Jan 02 2023 at 17:16):

I'll file an issue for it.

view this post on Zulip Nikolaus Wettstein (Jan 02 2023 at 17:22):

Ok, thank you!

view this post on Zulip Brendan Hansknecht (Jan 02 2023 at 17:26):

#4845


Last updated: Jul 05 2025 at 12:14 UTC