import { ParseResult } from '@effect/schema'
import { Schema } from '@effect/schema'
import { Boolean, Console, Effect, Equal, flow, pipe, ReadonlyArray } from 'effect'
const value = ['a', 'b', 'b', 'c', 'b', 'e']
const schema = Schema.transformOrFail(
Schema.array(Schema.string),
Schema.array(Schema.string),
flow(ReadonlyArray.filter(flow(Equal.equals('b'), Boolean.not)), ParseResult.succeed),
ParseResult.succeed,
)
pipe(value, Schema.parse(schema), Console.log, Effect.runSync)
// { _id: 'Either', _tag: 'Right', right: [ 'a', 'c', 'e' ] }
import { ParseResult } from '@effect/schema'
import { Schema } from '@effect/schema'
import { Boolean, Console, Effect, Equal, flow, pipe, ReadonlyArray } from 'effect'
const value = ['a', 'b', 'b', 'c', 'b', 'e']
const schema = Schema.transformOrFail(
Schema.array(Schema.string),
Schema.array(Schema.string),
flow(ReadonlyArray.filter(flow(Equal.equals('b'), Boolean.not)), ParseResult.succeed),
ParseResult.succeed,
)
pipe(value, Schema.parse(schema), Console.log, Effect.runSync)
// { _id: 'Either', _tag: 'Right', right: [ 'a', 'c', 'e' ] }