Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutating list values in Node mode #174

Open
brekk opened this issue May 14, 2024 · 0 comments
Open

Mutating list values in Node mode #174

brekk opened this issue May 14, 2024 · 0 comments

Comments

@brekk
Copy link
Contributor

brekk commented May 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant