Skip to content

List methods can be used on Set #187

@brekk

Description

@brekk

What version of Madlib are you running?

madlib@0.24.1

How is Madlib installed on your system?

Installed via npm

What were you trying to do?

I had a case where I was working with a Set of wrapped type values

Original error is available here. I will try to create a smaller reproduction case but my current attempts have failed.

What did you expect to happen?

I attempted to filter that Set using List.filter and saw some surprising runtime errors.

I was able to fix this issue by converting with Set.toList, but I was surprised at the way in which the compiler didn't yell at me.

What actually happened?

I saw the runtime barf while attempting to destructure and filter that Set:

RAW Set(
  [
    Local("@/Dependencies"),
    Local("@/Dot.main"),
    Local("@/External"),
    Local("@/MadlibJson"),
    Local("@/Mermaid.main"),
    Local("@/RenderDot"),
    Local("@/RenderMermaid"),
    Local("@/Ripgrep"),
    Local("@/String"),
    Local("@/Theme"),
    Prelude("Dictionary"),
    Prelude("Either"),
    Prelude("File"),
    Prelude("Function"),
    Prelude("IO"),
    Prelude("Json/Parse"),
    Prelude("List"),
    Prelude("Maybe"),
    Prelude("Process"),
    Prelude("Set"),
    Prelude("String"),
    Prelude("Tuple"),
    Prelude("Wish")
  ]
)
file:///Users/brekk/madness/craving/build/src/Mermaid.main.mjs:3910
  if (__x__.__constructor === "External" && true) {
            ^

TypeError: Cannot read properties of undefined (reading '__constructor')

Logs

No response

Code Targets

No response

Environment details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions