const getIp4 = (s: string, emptyJson: "error" | "noError") =>
Effect.gen(function* ($) {
const json =
emptyJson === "noError"
? yield* $(
parseJson2(s).pipe(
Effect.catchTag("EmptyJsonError", (err) =>
Effect.succeed({ ip: "176.1.1.1", name: "whatever" }),
),
),
)
: yield* $(parseJson2(s))
const ip = yield* $(RR.get("ip")(json))
return ip
})
const getIp4 = (s: string, emptyJson: "error" | "noError") =>
Effect.gen(function* ($) {
const json =
emptyJson === "noError"
? yield* $(
parseJson2(s).pipe(
Effect.catchTag("EmptyJsonError", (err) =>
Effect.succeed({ ip: "176.1.1.1", name: "whatever" }),
),
),
)
: yield* $(parseJson2(s))
const ip = yield* $(RR.get("ip")(json))
return ip
})