const s = S.Struct({ hello: S.String, world: S.Number })
const r = S.decodeUnknownEither(s)({ hello: 'Hello', world: 12 })
// Before
if(isLeft(r)){
console.log('wrong data: ', r)
} else {
console.log('here your data: ' , r)
}
// After
r.pipe(
Effect.flatMap(a => Console. log(a)),
Effect.catchTag('ParseError', a => Console.log('Something wrong with: ')),
Effect.runFork
)
const s = S.Struct({ hello: S.String, world: S.Number })
const r = S.decodeUnknownEither(s)({ hello: 'Hello', world: 12 })
// Before
if(isLeft(r)){
console.log('wrong data: ', r)
} else {
console.log('here your data: ' , r)
}
// After
r.pipe(
Effect.flatMap(a => Console. log(a)),
Effect.catchTag('ParseError', a => Console.log('Something wrong with: ')),
Effect.runFork
)