Skip to content

Mutating list values in Node mode #174

@brekk

Description

@brekk

Given a file like this:

import List from "List"



export type Metal = Gold | Silver | Bronze | Tin
export type Mixed = Numeric(Metal, Short) | Word(Metal, String)

nums :: Metal -> List Mixed
export nums = (m) => pipe(
  List.range(0),
  map(Numeric(m)),
)(3)

words :: Metal -> List Mixed
export words = (m) => map(Word(m), ["hey", "there", "spreadable", "butter"])

NUMBERS_AND_WORDS :: List Mixed
export NUMBERS_AND_WORDS = [
  ...nums(Gold),
  ...nums(Silver),
  ...nums(Bronze),
  ...words(Gold),
  ...words(Silver),
  ...words(Bronze),
]

FAILURE_CASE :: List Mixed
export FAILURE_CASE = [...NUMBERS_AND_WORDS, Word(Tin, "shit"), Word(Tin, "storm")]

The NUMBERS_AND_WORDS value is mutating in a test case downstream, but only in target: node mode.

Example repo here:

https://github.com/brekk/mad-abend/blob/main/src/ButterLists.spec.mad#L16-L44

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