All files / submodels/copy model.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22        4x             4x           8x        
import { HashMap, Schema } from 'effect'
import { defineTaggedUnion } from 'foldkit/schema'
 
/** What a cell shows after a copy. `copyId` ties the feedback to the copy that caused it. */
export const Feedback = defineTaggedUnion({
  Copied: { copyId: Schema.Int },
  Failed: { copyId: Schema.Int },
})
export type Feedback = typeof Feedback.Type
 
/** Feedback by readout cell, keyed by `${row}-${system}`. */
export const Model = Schema.Struct({
  feedbackByCellId: Schema.HashMap(Schema.String, Feedback),
  copyCount: Schema.Int,
})
export type Model = typeof Model.Type
 
export const init = (): Model => ({
  feedbackByCellId: HashMap.empty(),
  copyCount: 0,
})