Stream: beginners

Topic: ✔ How to make an empty list


view this post on Zulip Luke Boswell (Nov 06 2022 at 05:23):

I've got this error and I'm not sure how to make an empty list of a particular type? Been trying a few different things but I'm at a bit of a loss.

── TYPE MISMATCH ──────────────────────────────────────────────────── day4.roc 

Something is off with the body of the emptyBingoBoard definition:

31  emptyBingoBoard : ParsedInput
32  emptyBingoBoard = {bingoNumbers : [], bingoBoards : [] }
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The body is a record of type:

    { bingoBoards : List *, bingoNumbers : List * }

But the type annotation on emptyBingoBoard says it should be:

    { bingoNumbers : List U64, boards : List BingoBoard }

Tip: Seems like a record field typo. Maybe bingoBoards should be
boards?

Tip: Can more type annotations be added? Type annotations always help
me give more specific messages, and I think they could help a lot in
this case

view this post on Zulip Luke Boswell (Nov 06 2022 at 05:26):

This is the best I've come up with so far..

» [1u64] |> List.drop 1

[] : List U64

view this post on Zulip Brendan Hansknecht (Nov 06 2022 at 05:32):

That is really strange. I wonder if it is some sort of regression. I have definitely created lists of various types just with []

view this post on Zulip Brendan Hansknecht (Nov 06 2022 at 05:33):

Can you share more context of your program?

view this post on Zulip Brendan Hansknecht (Nov 06 2022 at 05:33):

Oh wait, the types have different names of the record variables

view this post on Zulip Brendan Hansknecht (Nov 06 2022 at 05:34):

boards vs bingoBoards

view this post on Zulip Brendan Hansknecht (Nov 06 2022 at 05:34):

That is probably the root issue

view this post on Zulip Brendan Hansknecht (Nov 06 2022 at 05:34):

The other info is probably fluff in the error message.

view this post on Zulip Luke Boswell (Nov 06 2022 at 05:43):

Thank you

view this post on Zulip Luke Boswell (Nov 06 2022 at 05:44):

I should learn to read these messages closer

view this post on Zulip Notification Bot (Nov 06 2022 at 05:55):

Luke Boswell has marked this topic as resolved.

view this post on Zulip Tommy Graves (Nov 07 2022 at 14:40):

Those tips should probably be displayed in the reverse order, or the second tip should be dropped entirely! The first tip correctly identified what was going on.

view this post on Zulip Anton (Nov 07 2022 at 14:43):

Yeah both tips are currently given "equal visual weight", which is not ideal.


Last updated: Jul 06 2025 at 12:14 UTC