版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

1302 строки
39 KiB

  1. /**
  2. * @since 2.0.0
  3. */
  4. import { Alt3, Alt3C } from './Alt'
  5. import { Applicative3, Applicative3C } from './Applicative'
  6. import { Apply1, Apply3 } from './Apply'
  7. import { Bifunctor3 } from './Bifunctor'
  8. import { Chain3 } from './Chain'
  9. import { Compactable3C } from './Compactable'
  10. import * as E from './Either'
  11. import { Filterable3C } from './Filterable'
  12. import { FromEither3 } from './FromEither'
  13. import { FromIO3 } from './FromIO'
  14. import { FromReader3 } from './FromReader'
  15. import { FromTask3 } from './FromTask'
  16. import { Lazy } from './function'
  17. import { Functor3 } from './Functor'
  18. import { IO } from './IO'
  19. import { IOEither } from './IOEither'
  20. import { Monad3, Monad3C } from './Monad'
  21. import { MonadIO3 } from './MonadIO'
  22. import { MonadTask3, MonadTask3C } from './MonadTask'
  23. import { MonadThrow3, MonadThrow3C } from './MonadThrow'
  24. import { Monoid } from './Monoid'
  25. import { Option } from './Option'
  26. import { Pointed3 } from './Pointed'
  27. import { Predicate } from './Predicate'
  28. import * as R from './Reader'
  29. import { ReaderEither } from './ReaderEither'
  30. import * as RIO from './ReaderIO'
  31. import * as RT from './ReaderTask'
  32. import { ReadonlyNonEmptyArray } from './ReadonlyNonEmptyArray'
  33. import { Refinement } from './Refinement'
  34. import { Semigroup } from './Semigroup'
  35. import * as T from './Task'
  36. import * as TE from './TaskEither'
  37. import Either = E.Either
  38. import Task = T.Task
  39. import TaskEither = TE.TaskEither
  40. import Reader = R.Reader
  41. import ReaderIO = RIO.ReaderIO
  42. import ReaderTask = RT.ReaderTask
  43. /**
  44. * @category model
  45. * @since 2.0.0
  46. */
  47. export interface ReaderTaskEither<R, E, A> {
  48. (r: R): TaskEither<E, A>
  49. }
  50. /**
  51. * @category conversions
  52. * @since 2.0.0
  53. */
  54. export declare const fromTaskEither: <E, A, R = unknown>(fa: TaskEither<E, A>) => ReaderTaskEither<R, E, A>
  55. /**
  56. * @category constructors
  57. * @since 2.0.0
  58. */
  59. export declare const left: <R, E = never, A = never>(e: E) => ReaderTaskEither<R, E, A>
  60. /**
  61. * @category constructors
  62. * @since 2.0.0
  63. */
  64. export declare const right: <R, E = never, A = never>(a: A) => ReaderTaskEither<R, E, A>
  65. /**
  66. * @category constructors
  67. * @since 2.0.0
  68. */
  69. export declare const rightTask: <R, E = never, A = never>(ma: Task<A>) => ReaderTaskEither<R, E, A>
  70. /**
  71. * @category constructors
  72. * @since 2.0.0
  73. */
  74. export declare const leftTask: <R, E = never, A = never>(me: Task<E>) => ReaderTaskEither<R, E, A>
  75. /**
  76. * @category constructors
  77. * @since 2.0.0
  78. */
  79. export declare const rightReader: <R, E = never, A = never>(ma: Reader<R, A>) => ReaderTaskEither<R, E, A>
  80. /**
  81. * @category constructors
  82. * @since 2.0.0
  83. */
  84. export declare const leftReader: <R, E = never, A = never>(me: Reader<R, E>) => ReaderTaskEither<R, E, A>
  85. /**
  86. * @category constructors
  87. * @since 2.5.0
  88. */
  89. export declare const rightReaderTask: <R, E = never, A = never>(ma: ReaderTask<R, A>) => ReaderTaskEither<R, E, A>
  90. /**
  91. * @category constructors
  92. * @since 2.5.0
  93. */
  94. export declare const leftReaderTask: <R, E = never, A = never>(me: ReaderTask<R, E>) => ReaderTaskEither<R, E, A>
  95. /**
  96. * @category constructors
  97. * @since 2.0.0
  98. */
  99. export declare const rightIO: <R, E = never, A = never>(ma: IO<A>) => ReaderTaskEither<R, E, A>
  100. /**
  101. * @category constructors
  102. * @since 2.0.0
  103. */
  104. export declare const leftIO: <R, E = never, A = never>(me: IO<E>) => ReaderTaskEither<R, E, A>
  105. /**
  106. * @category constructors
  107. * @since 2.13.0
  108. */
  109. export declare const rightReaderIO: <R, E = never, A = never>(ma: ReaderIO<R, A>) => ReaderTaskEither<R, E, A>
  110. /**
  111. * @category constructors
  112. * @since 2.13.0
  113. */
  114. export declare const leftReaderIO: <R, E = never, A = never>(me: ReaderIO<R, E>) => ReaderTaskEither<R, E, A>
  115. /**
  116. * @category conversions
  117. * @since 2.0.0
  118. */
  119. export declare const fromEither: <E, A, R = unknown>(fa: Either<E, A>) => ReaderTaskEither<R, E, A>
  120. /**
  121. * @category conversions
  122. * @since 2.11.0
  123. */
  124. export declare const fromReader: <R, A, E = never>(fa: Reader<R, A>) => ReaderTaskEither<R, E, A>
  125. /**
  126. * @category conversions
  127. * @since 2.0.0
  128. */
  129. export declare const fromIO: <A, R = unknown, E = never>(fa: IO<A>) => ReaderTaskEither<R, E, A>
  130. /**
  131. * @category conversions
  132. * @since 2.0.0
  133. */
  134. export declare const fromTask: <A, R = unknown, E = never>(fa: Task<A>) => ReaderTaskEither<R, E, A>
  135. /**
  136. * @category conversions
  137. * @since 2.0.0
  138. */
  139. export declare const fromIOEither: <E, A, R = unknown>(fa: IOEither<E, A>) => ReaderTaskEither<R, E, A>
  140. /**
  141. * @category conversions
  142. * @since 2.0.0
  143. */
  144. export declare const fromReaderEither: <R, E, A>(fa: ReaderEither<R, E, A>) => ReaderTaskEither<R, E, A>
  145. /**
  146. * @category pattern matching
  147. * @since 2.10.0
  148. */
  149. export declare const match: <E, B, A>(
  150. onLeft: (e: E) => B,
  151. onRight: (a: A) => B
  152. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTask<R, B>
  153. /**
  154. * Less strict version of [`match`](#match).
  155. *
  156. * The `W` suffix (short for **W**idening) means that the handler return types will be merged.
  157. *
  158. * @category pattern matching
  159. * @since 2.10.0
  160. */
  161. export declare const matchW: <E, B, A, C>(
  162. onLeft: (e: E) => B,
  163. onRight: (a: A) => C
  164. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTask<R, B | C>
  165. /**
  166. * The `E` suffix (short for **E**ffect) means that the handlers return an effect (`ReaderTask`).
  167. *
  168. * @category pattern matching
  169. * @since 2.10.0
  170. */
  171. export declare const matchE: <R, E, A, B>(
  172. onLeft: (e: E) => ReaderTask<R, B>,
  173. onRight: (a: A) => ReaderTask<R, B>
  174. ) => (ma: ReaderTaskEither<R, E, A>) => ReaderTask<R, B>
  175. /**
  176. * Alias of [`matchE`](#matche).
  177. *
  178. * @category pattern matching
  179. * @since 2.0.0
  180. */
  181. export declare const fold: <R, E, A, B>(
  182. onLeft: (e: E) => RT.ReaderTask<R, B>,
  183. onRight: (a: A) => RT.ReaderTask<R, B>
  184. ) => (ma: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, B>
  185. /**
  186. * Less strict version of [`matchE`](#matche).
  187. *
  188. * The `W` suffix (short for **W**idening) means that the handler return types will be merged.
  189. *
  190. * @category pattern matching
  191. * @since 2.10.0
  192. */
  193. export declare const matchEW: <E, R2, B, A, R3, C>(
  194. onLeft: (e: E) => ReaderTask<R2, B>,
  195. onRight: (a: A) => ReaderTask<R3, C>
  196. ) => <R1>(ma: ReaderTaskEither<R1, E, A>) => ReaderTask<R1 & R2 & R3, B | C>
  197. /**
  198. * Alias of [`matchEW`](#matchew).
  199. *
  200. * @category pattern matching
  201. * @since 2.10.0
  202. */
  203. export declare const foldW: <E, R2, B, A, R3, C>(
  204. onLeft: (e: E) => RT.ReaderTask<R2, B>,
  205. onRight: (a: A) => RT.ReaderTask<R3, C>
  206. ) => <R1>(ma: ReaderTaskEither<R1, E, A>) => RT.ReaderTask<R1 & R2 & R3, B | C>
  207. /**
  208. * @category error handling
  209. * @since 2.0.0
  210. */
  211. export declare const getOrElse: <R, E, A>(
  212. onLeft: (e: E) => ReaderTask<R, A>
  213. ) => (ma: ReaderTaskEither<R, E, A>) => ReaderTask<R, A>
  214. /**
  215. * Less strict version of [`getOrElse`](#getorelse).
  216. *
  217. * The `W` suffix (short for **W**idening) means that the handler return type will be merged.
  218. *
  219. * @category error handling
  220. * @since 2.6.0
  221. */
  222. export declare const getOrElseW: <R2, E, B>(
  223. onLeft: (e: E) => ReaderTask<R2, B>
  224. ) => <R1, A>(ma: ReaderTaskEither<R1, E, A>) => ReaderTask<R1 & R2, A | B>
  225. /**
  226. * @category conversions
  227. * @since 2.10.0
  228. */
  229. export declare const toUnion: <R, E, A>(fa: ReaderTaskEither<R, E, A>) => ReaderTask<R, E | A>
  230. /**
  231. * @category conversions
  232. * @since 2.12.0
  233. */
  234. export declare const fromNullable: <E>(e: E) => <R, A>(a: A) => ReaderTaskEither<R, E, NonNullable<A>>
  235. /**
  236. * @category lifting
  237. * @since 2.12.0
  238. */
  239. export declare const fromNullableK: <E>(
  240. e: E
  241. ) => <A extends ReadonlyArray<unknown>, B>(
  242. f: (...a: A) => B | null | undefined
  243. ) => <R = unknown>(...a: A) => ReaderTaskEither<R, E, NonNullable<B>>
  244. /**
  245. * @category sequencing
  246. * @since 2.12.0
  247. */
  248. export declare const chainNullableK: <E>(
  249. e: E
  250. ) => <A, B>(
  251. f: (a: A) => B | null | undefined
  252. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, NonNullable<B>>
  253. /**
  254. * Changes the value of the local context during the execution of the action `ma` (similar to `Contravariant`'s
  255. * `contramap`).
  256. *
  257. * @since 2.0.0
  258. */
  259. export declare const local: <R2, R1>(
  260. f: (r2: R2) => R1
  261. ) => <E, A>(ma: ReaderTaskEither<R1, E, A>) => ReaderTaskEither<R2, E, A>
  262. /**
  263. * Less strict version of [`asksReaderTaskEither`](#asksreadertaskeither).
  264. *
  265. * The `W` suffix (short for **W**idening) means that the environment types will be merged.
  266. *
  267. * @category constructors
  268. * @since 2.11.0
  269. */
  270. export declare const asksReaderTaskEitherW: <R1, R2, E, A>(
  271. f: (r1: R1) => ReaderTaskEither<R2, E, A>
  272. ) => ReaderTaskEither<R1 & R2, E, A>
  273. /**
  274. * Effectfully accesses the environment.
  275. *
  276. * @category constructors
  277. * @since 2.11.0
  278. */
  279. export declare const asksReaderTaskEither: <R, E, A>(
  280. f: (r: R) => ReaderTaskEither<R, E, A>
  281. ) => ReaderTaskEither<R, E, A>
  282. /**
  283. * @category error handling
  284. * @since 2.0.0
  285. */
  286. export declare const orElse: <R, E1, A, E2>(
  287. onLeft: (e: E1) => ReaderTaskEither<R, E2, A>
  288. ) => (ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E2, A>
  289. /**
  290. * Less strict version of [`orElse`](#orelse).
  291. *
  292. * The `W` suffix (short for **W**idening) means that the environment types and the return types will be merged.
  293. *
  294. * @category error handling
  295. * @since 2.10.0
  296. */
  297. export declare const orElseW: <E1, R1, E2, B>(
  298. onLeft: (e: E1) => ReaderTaskEither<R1, E2, B>
  299. ) => <R2, A>(ma: ReaderTaskEither<R2, E1, A>) => ReaderTaskEither<R1 & R2, E2, A | B>
  300. /**
  301. * @category error handling
  302. * @since 2.11.0
  303. */
  304. export declare const orElseFirst: <E, R, B>(
  305. onLeft: (e: E) => ReaderTaskEither<R, E, B>
  306. ) => <A>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  307. /**
  308. * The `W` suffix (short for **W**idening) means that the environment types and the return types will be merged.
  309. *
  310. * @category error handling
  311. * @since 2.11.0
  312. */
  313. export declare const orElseFirstW: <E1, R2, E2, B>(
  314. onLeft: (e: E1) => ReaderTaskEither<R2, E2, B>
  315. ) => <R1, A>(ma: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, A>
  316. /**
  317. * @category error handling
  318. * @since 2.11.0
  319. */
  320. export declare const orLeft: <E1, R, E2>(
  321. onLeft: (e: E1) => ReaderTask<R, E2>
  322. ) => <A>(fa: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E2, A>
  323. /**
  324. * @since 2.0.0
  325. */
  326. export declare const swap: <R, E, A>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, A, E>
  327. /**
  328. * @category lifting
  329. * @since 2.4.0
  330. */
  331. export declare const fromIOEitherK: <E, A extends readonly unknown[], B>(
  332. f: (...a: A) => IOEither<E, B>
  333. ) => <R = unknown>(...a: A) => ReaderTaskEither<R, E, B>
  334. /**
  335. * Less strict version of [`chainIOEitherK`](#chainioeitherk).
  336. *
  337. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  338. *
  339. * @category sequencing
  340. * @since 2.6.1
  341. */
  342. export declare const chainIOEitherKW: <E2, A, B>(
  343. f: (a: A) => IOEither<E2, B>
  344. ) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E1 | E2, B>
  345. /**
  346. * @category sequencing
  347. * @since 2.4.0
  348. */
  349. export declare const chainIOEitherK: <E, A, B>(
  350. f: (a: A) => IOEither<E, B>
  351. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  352. /**
  353. * @category lifting
  354. * @since 2.4.0
  355. */
  356. export declare const fromTaskEitherK: <E, A extends readonly unknown[], B>(
  357. f: (...a: A) => TE.TaskEither<E, B>
  358. ) => <R = unknown>(...a: A) => ReaderTaskEither<R, E, B>
  359. /**
  360. * Less strict version of [`chainTaskEitherK`](#chaintaskeitherk).
  361. *
  362. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  363. *
  364. * @category sequencing
  365. * @since 2.6.1
  366. */
  367. export declare const chainTaskEitherKW: <E2, A, B>(
  368. f: (a: A) => TaskEither<E2, B>
  369. ) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E1 | E2, B>
  370. /**
  371. * @category sequencing
  372. * @since 2.4.0
  373. */
  374. export declare const chainTaskEitherK: <E, A, B>(
  375. f: (a: A) => TaskEither<E, B>
  376. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  377. /**
  378. * Less strict version of [`chainFirstTaskEitherK`](#chainfirsttaskeitherk).
  379. *
  380. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  381. *
  382. * @category sequencing
  383. * @since 2.11.0
  384. */
  385. export declare const chainFirstTaskEitherKW: <E2, A, B>(
  386. f: (a: A) => TaskEither<E2, B>
  387. ) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E1 | E2, A>
  388. /**
  389. * @category sequencing
  390. * @since 2.11.0
  391. */
  392. export declare const chainFirstTaskEitherK: <E, A, B>(
  393. f: (a: A) => TaskEither<E, B>
  394. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  395. /**
  396. * @category lifting
  397. * @since 2.11.0
  398. */
  399. export declare const fromReaderEitherK: <R, E, A extends readonly unknown[], B>(
  400. f: (...a: A) => ReaderEither<R, E, B>
  401. ) => (...a: A) => ReaderTaskEither<R, E, B>
  402. /**
  403. * Less strict version of [`chainReaderEitherK`](#chainreadereitherk).
  404. *
  405. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  406. *
  407. * @category sequencing
  408. * @since 2.11.0
  409. */
  410. export declare const chainReaderEitherKW: <R2, E2, A, B>(
  411. f: (a: A) => ReaderEither<R2, E2, B>
  412. ) => <R1, E1>(ma: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, B>
  413. /**
  414. * @category sequencing
  415. * @since 2.11.0
  416. */
  417. export declare const chainReaderEitherK: <R, E, A, B>(
  418. f: (a: A) => ReaderEither<R, E, B>
  419. ) => (ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  420. /**
  421. * Less strict version of [`chainFirstReaderEitherK`](#chainfirstreadereitherk).
  422. *
  423. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  424. *
  425. * @category sequencing
  426. * @since 2.11.0
  427. */
  428. export declare const chainFirstReaderEitherKW: <R2, E2, A, B>(
  429. f: (a: A) => ReaderEither<R2, E2, B>
  430. ) => <R1, E1>(ma: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, A>
  431. /**
  432. * @category sequencing
  433. * @since 2.11.0
  434. */
  435. export declare const chainFirstReaderEitherK: <R, E, A, B>(
  436. f: (a: A) => ReaderEither<R, E, B>
  437. ) => (ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  438. /**
  439. * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
  440. * use the type constructor `F` to represent some computational context.
  441. *
  442. * @category mapping
  443. * @since 2.0.0
  444. */
  445. export declare const map: <A, B>(f: (a: A) => B) => <R, E>(fa: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  446. /**
  447. * Map a pair of functions over the two last type arguments of the bifunctor.
  448. *
  449. * @category mapping
  450. * @since 2.0.0
  451. */
  452. export declare const bimap: <E, G, A, B>(
  453. f: (e: E) => G,
  454. g: (a: A) => B
  455. ) => <R>(fa: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, G, B>
  456. /**
  457. * Map a function over the second type argument of a bifunctor.
  458. *
  459. * @category error handling
  460. * @since 2.0.0
  461. */
  462. export declare const mapLeft: <E, G>(
  463. f: (e: E) => G
  464. ) => <R, A>(fa: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, G, A>
  465. /**
  466. * @since 2.0.0
  467. */
  468. export declare const ap: <R, E, A>(
  469. fa: ReaderTaskEither<R, E, A>
  470. ) => <B>(fab: ReaderTaskEither<R, E, (a: A) => B>) => ReaderTaskEither<R, E, B>
  471. /**
  472. * Less strict version of [`ap`](#ap).
  473. *
  474. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  475. *
  476. * @since 2.8.0
  477. */
  478. export declare const apW: <R2, E2, A>(
  479. fa: ReaderTaskEither<R2, E2, A>
  480. ) => <R1, E1, B>(fab: ReaderTaskEither<R1, E1, (a: A) => B>) => ReaderTaskEither<R1 & R2, E1 | E2, B>
  481. /**
  482. * @category constructors
  483. * @since 2.7.0
  484. */
  485. export declare const of: <R = unknown, E = never, A = never>(a: A) => ReaderTaskEither<R, E, A>
  486. /**
  487. * Composes computations in sequence, using the return value of one computation to determine the next computation.
  488. *
  489. * @category sequencing
  490. * @since 2.0.0
  491. */
  492. export declare const chain: <R, E, A, B>(
  493. f: (a: A) => ReaderTaskEither<R, E, B>
  494. ) => (ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  495. /**
  496. * Less strict version of [`chain`](#chain).
  497. *
  498. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  499. *
  500. * @category sequencing
  501. * @since 2.6.0
  502. */
  503. export declare const chainW: <R2, E2, A, B>(
  504. f: (a: A) => ReaderTaskEither<R2, E2, B>
  505. ) => <R1, E1>(ma: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, B>
  506. /**
  507. * Less strict version of [`flatten`](#flatten).
  508. *
  509. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  510. *
  511. * @category sequencing
  512. * @since 2.11.0
  513. */
  514. export declare const flattenW: <R1, E1, R2, E2, A>(
  515. mma: ReaderTaskEither<R1, E1, ReaderTaskEither<R2, E2, A>>
  516. ) => ReaderTaskEither<R1 & R2, E1 | E2, A>
  517. /**
  518. * @category sequencing
  519. * @since 2.0.0
  520. */
  521. export declare const flatten: <R, E, A>(
  522. mma: ReaderTaskEither<R, E, ReaderTaskEither<R, E, A>>
  523. ) => ReaderTaskEither<R, E, A>
  524. /**
  525. * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
  526. * types of kind `* -> *`.
  527. *
  528. * @category error handling
  529. * @since 2.0.0
  530. */
  531. export declare const alt: <R, E, A>(
  532. that: () => ReaderTaskEither<R, E, A>
  533. ) => (fa: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  534. /**
  535. * Less strict version of [`alt`](#alt).
  536. *
  537. * The `W` suffix (short for **W**idening) means that the environment, the error and the return types will be merged.
  538. *
  539. * @category error handling
  540. * @since 2.9.0
  541. */
  542. export declare const altW: <R2, E2, B>(
  543. that: () => ReaderTaskEither<R2, E2, B>
  544. ) => <R1, E1, A>(fa: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E2, A | B>
  545. /**
  546. * @since 2.0.0
  547. */
  548. export declare const throwError: MonadThrow3<URI>['throwError']
  549. /**
  550. * @category type lambdas
  551. * @since 2.0.0
  552. */
  553. export declare const URI = 'ReaderTaskEither'
  554. /**
  555. * @category type lambdas
  556. * @since 2.0.0
  557. */
  558. export declare type URI = typeof URI
  559. declare module './HKT' {
  560. interface URItoKind3<R, E, A> {
  561. readonly [URI]: ReaderTaskEither<R, E, A>
  562. }
  563. }
  564. /**
  565. * @category filtering
  566. * @since 2.10.0
  567. */
  568. export declare const getCompactable: <E>(M: Monoid<E>) => Compactable3C<'ReaderTaskEither', E>
  569. /**
  570. * @category filtering
  571. * @since 2.10.0
  572. */
  573. export declare function getFilterable<E>(M: Monoid<E>): Filterable3C<URI, E>
  574. /**
  575. * The default [`ApplicativePar`](#applicativepar) instance returns the first error, if you want to
  576. * get all errors you need to provide a way to concatenate them via a `Semigroup`.
  577. *
  578. * See [`getApplicativeValidation`](./Either.ts.html#getapplicativevalidation).
  579. *
  580. * @category error handling
  581. * @since 2.7.0
  582. */
  583. export declare function getApplicativeReaderTaskValidation<E>(A: Apply1<T.URI>, S: Semigroup<E>): Applicative3C<URI, E>
  584. /**
  585. * The default [`Alt`](#alt) instance returns the last error, if you want to
  586. * get all errors you need to provide a way to concatenate them via a `Semigroup`.
  587. *
  588. * See [`getAltValidation`](./Either.ts.html#getaltvalidation).
  589. *
  590. * @category error handling
  591. * @since 2.7.0
  592. */
  593. export declare function getAltReaderTaskValidation<E>(S: Semigroup<E>): Alt3C<URI, E>
  594. /**
  595. * @category instances
  596. * @since 2.7.0
  597. */
  598. export declare const Functor: Functor3<URI>
  599. /**
  600. * @category mapping
  601. * @since 2.10.0
  602. */
  603. export declare const flap: <A>(a: A) => <R, E, B>(fab: ReaderTaskEither<R, E, (a: A) => B>) => ReaderTaskEither<R, E, B>
  604. /**
  605. * @category instances
  606. * @since 2.10.0
  607. */
  608. export declare const Pointed: Pointed3<URI>
  609. /**
  610. * Runs computations in parallel.
  611. *
  612. * @category instances
  613. * @since 2.10.0
  614. */
  615. export declare const ApplyPar: Apply3<URI>
  616. /**
  617. * Combine two effectful actions, keeping only the result of the first.
  618. *
  619. * @since 2.0.0
  620. */
  621. export declare const apFirst: <R, E, B>(
  622. second: ReaderTaskEither<R, E, B>
  623. ) => <A>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  624. /**
  625. * Less strict version of [`apFirst`](#apfirst).
  626. *
  627. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  628. *
  629. * @since 2.12.0
  630. */
  631. export declare const apFirstW: <R2, E2, B>(
  632. second: ReaderTaskEither<R2, E2, B>
  633. ) => <R1, E1, A>(first: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, A>
  634. /**
  635. * Combine two effectful actions, keeping only the result of the second.
  636. *
  637. * @since 2.0.0
  638. */
  639. export declare const apSecond: <R, E, B>(
  640. second: ReaderTaskEither<R, E, B>
  641. ) => <A>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  642. /**
  643. * Less strict version of [`apSecond`](#apsecond).
  644. *
  645. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  646. *
  647. * @since 2.12.0
  648. */
  649. export declare const apSecondW: <R2, E2, B>(
  650. second: ReaderTaskEither<R2, E2, B>
  651. ) => <R1, E1, A>(first: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, B>
  652. /**
  653. * Runs computations in parallel.
  654. *
  655. * @category instances
  656. * @since 2.7.0
  657. */
  658. export declare const ApplicativePar: Applicative3<URI>
  659. /**
  660. * Runs computations sequentially.
  661. *
  662. * @category instances
  663. * @since 2.10.0
  664. */
  665. export declare const ApplySeq: Apply3<URI>
  666. /**
  667. * Runs computations sequentially.
  668. *
  669. * @category instances
  670. * @since 2.7.0
  671. */
  672. export declare const ApplicativeSeq: Applicative3<URI>
  673. /**
  674. * @category instances
  675. * @since 2.10.0
  676. */
  677. export declare const Chain: Chain3<URI>
  678. /**
  679. * @category instances
  680. * @since 2.10.0
  681. */
  682. export declare const Monad: Monad3<URI>
  683. /**
  684. * @category instances
  685. * @since 2.10.0
  686. */
  687. export declare const MonadIO: MonadIO3<URI>
  688. /**
  689. * @category instances
  690. * @since 2.10.0
  691. */
  692. export declare const MonadTask: MonadTask3<URI>
  693. /**
  694. * @category instances
  695. * @since 2.10.0
  696. */
  697. export declare const MonadThrow: MonadThrow3<URI>
  698. /**
  699. * Composes computations in sequence, using the return value of one computation to determine the next computation and
  700. * keeping only the result of the first.
  701. *
  702. * @category sequencing
  703. * @since 2.0.0
  704. */
  705. export declare const chainFirst: <R, E, A, B>(
  706. f: (a: A) => ReaderTaskEither<R, E, B>
  707. ) => (ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  708. /**
  709. * Less strict version of [`chainFirst`](#chainfirst).
  710. *
  711. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  712. *
  713. * @category sequencing
  714. * @since 2.8.0
  715. */
  716. export declare const chainFirstW: <R2, E2, A, B>(
  717. f: (a: A) => ReaderTaskEither<R2, E2, B>
  718. ) => <R1, E1>(ma: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E1 | E2, A>
  719. /**
  720. * @category instances
  721. * @since 2.7.0
  722. */
  723. export declare const Bifunctor: Bifunctor3<URI>
  724. /**
  725. * @category instances
  726. * @since 2.7.0
  727. */
  728. export declare const Alt: Alt3<URI>
  729. /**
  730. * @category instances
  731. * @since 2.11.0
  732. */
  733. export declare const FromReader: FromReader3<URI>
  734. /**
  735. * Reads the current context.
  736. *
  737. * @category constructors
  738. * @since 2.0.0
  739. */
  740. export declare const ask: <R, E = never>() => ReaderTaskEither<R, E, R>
  741. /**
  742. * Projects a value from the global context in a `ReaderEither`.
  743. *
  744. * @category constructors
  745. * @since 2.0.0
  746. */
  747. export declare const asks: <R, A, E = never>(f: (r: R) => A) => ReaderTaskEither<R, E, A>
  748. /**
  749. * @category lifting
  750. * @since 2.11.0
  751. */
  752. export declare const fromReaderK: <A extends ReadonlyArray<unknown>, R, B>(
  753. f: (...a: A) => Reader<R, B>
  754. ) => <E = never>(...a: A) => ReaderTaskEither<R, E, B>
  755. /**
  756. * @category sequencing
  757. * @since 2.11.0
  758. */
  759. export declare const chainReaderK: <A, R, B>(
  760. f: (a: A) => Reader<R, B>
  761. ) => <E>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  762. /**
  763. * Less strict version of [`chainReaderK`](#chainreaderk).
  764. *
  765. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  766. *
  767. * @category sequencing
  768. * @since 2.11.0
  769. */
  770. export declare const chainReaderKW: <A, R1, B>(
  771. f: (a: A) => R.Reader<R1, B>
  772. ) => <R2, E>(ma: ReaderTaskEither<R2, E, A>) => ReaderTaskEither<R1 & R2, E, B>
  773. /**
  774. * @category sequencing
  775. * @since 2.11.0
  776. */
  777. export declare const chainFirstReaderK: <A, R, B>(
  778. f: (a: A) => R.Reader<R, B>
  779. ) => <E>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  780. /**
  781. * Less strict version of [`chainFirstReaderK`](#chainfirstreaderk).
  782. *
  783. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  784. *
  785. * @category sequencing
  786. * @since 2.11.0
  787. */
  788. export declare const chainFirstReaderKW: <A, R1, B>(
  789. f: (a: A) => R.Reader<R1, B>
  790. ) => <R2, E>(ma: ReaderTaskEither<R2, E, A>) => ReaderTaskEither<R1 & R2, E, A>
  791. /**
  792. * @category lifting
  793. * @since 2.11.0
  794. */
  795. export declare const fromReaderTaskK: <A extends readonly unknown[], R, B>(
  796. f: (...a: A) => RT.ReaderTask<R, B>
  797. ) => <E = never>(...a: A) => ReaderTaskEither<R, E, B>
  798. /**
  799. * Less strict version of [`chainReaderTaskK`](#chainreadertaskk).
  800. *
  801. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  802. *
  803. * @category sequencing
  804. * @since 2.11.0
  805. */
  806. export declare const chainReaderTaskKW: <A, R2, B>(
  807. f: (a: A) => RT.ReaderTask<R2, B>
  808. ) => <R1, E>(ma: ReaderTaskEither<R1, E, A>) => ReaderTaskEither<R1 & R2, E, B>
  809. /**
  810. * @category sequencing
  811. * @since 2.11.0
  812. */
  813. export declare const chainReaderTaskK: <A, R, B>(
  814. f: (a: A) => RT.ReaderTask<R, B>
  815. ) => <E>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  816. /**
  817. * Less strict version of [`chainFirstReaderTaskK`](#chainfirstreadertaskk).
  818. *
  819. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  820. *
  821. * @category sequencing
  822. * @since 2.11.0
  823. */
  824. export declare const chainFirstReaderTaskKW: <A, R2, B>(
  825. f: (a: A) => RT.ReaderTask<R2, B>
  826. ) => <R1, E>(ma: ReaderTaskEither<R1, E, A>) => ReaderTaskEither<R1 & R2, E, A>
  827. /**
  828. * @category sequencing
  829. * @since 2.11.0
  830. */
  831. export declare const chainFirstReaderTaskK: <A, R, B>(
  832. f: (a: A) => RT.ReaderTask<R, B>
  833. ) => <E>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  834. /**
  835. * @category lifting
  836. * @since 2.13.0
  837. */
  838. export declare const fromReaderIOK: <A extends readonly unknown[], R, B>(
  839. f: (...a: A) => RIO.ReaderIO<R, B>
  840. ) => <E = never>(...a: A) => ReaderTaskEither<R, E, B>
  841. /**
  842. * Less strict version of [`chainReaderIOK`](#chainreaderiok).
  843. *
  844. * @category sequencing
  845. * @since 2.13.0
  846. */
  847. export declare const chainReaderIOKW: <A, R2, B>(
  848. f: (a: A) => ReaderIO<R2, B>
  849. ) => <R1, E>(ma: ReaderTaskEither<R1, E, A>) => ReaderTaskEither<R1 & R2, E, B>
  850. /**
  851. * @category sequencing
  852. * @since 2.13.0
  853. */
  854. export declare const chainReaderIOK: <A, R, B>(
  855. f: (a: A) => ReaderIO<R, B>
  856. ) => <E>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  857. /**
  858. * Less strict version of [`chainFirstReaderIOK`](#chainfirstreaderiok).
  859. *
  860. * @category sequencing
  861. * @since 2.13.0
  862. */
  863. export declare const chainFirstReaderIOKW: <A, R2, B>(
  864. f: (a: A) => ReaderIO<R2, B>
  865. ) => <R1, E>(ma: ReaderTaskEither<R1, E, A>) => ReaderTaskEither<R1 & R2, E, A>
  866. /**
  867. * @category sequencing
  868. * @since 2.13.0
  869. */
  870. export declare const chainFirstReaderIOK: <A, R, B>(
  871. f: (a: A) => ReaderIO<R, B>
  872. ) => <E>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  873. /**
  874. * @category instances
  875. * @since 2.10.0
  876. */
  877. export declare const FromEither: FromEither3<URI>
  878. /**
  879. * @category conversions
  880. * @since 2.0.0
  881. */
  882. export declare const fromOption: <E>(onNone: Lazy<E>) => <A, R = unknown>(fa: Option<A>) => ReaderTaskEither<R, E, A>
  883. /**
  884. * @category lifting
  885. * @since 2.10.0
  886. */
  887. export declare const fromOptionK: <E>(
  888. onNone: Lazy<E>
  889. ) => <A extends ReadonlyArray<unknown>, B>(
  890. f: (...a: A) => Option<B>
  891. ) => <R = unknown>(...a: A) => ReaderTaskEither<R, E, B>
  892. /**
  893. * @category sequencing
  894. * @since 2.10.0
  895. */
  896. export declare const chainOptionK: <E>(
  897. onNone: Lazy<E>
  898. ) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  899. /**
  900. * @category sequencing
  901. * @since 2.4.0
  902. */
  903. export declare const chainEitherK: <E, A, B>(
  904. f: (a: A) => E.Either<E, B>
  905. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  906. /**
  907. * Less strict version of [`chainEitherK`](#chaineitherk).
  908. *
  909. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  910. *
  911. * @category sequencing
  912. * @since 2.6.1
  913. */
  914. export declare const chainEitherKW: <E2, A, B>(
  915. f: (a: A) => Either<E2, B>
  916. ) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E1 | E2, B>
  917. /**
  918. * @category sequencing
  919. * @since 2.12.0
  920. */
  921. export declare const chainFirstEitherK: <A, E, B>(
  922. f: (a: A) => E.Either<E, B>
  923. ) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  924. /**
  925. * Less strict version of [`chainFirstEitherK`](#chainfirsteitherk).
  926. *
  927. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  928. *
  929. * @category sequencing
  930. * @since 2.12.0
  931. */
  932. export declare const chainFirstEitherKW: <A, E2, B>(
  933. f: (a: A) => Either<E2, B>
  934. ) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E1 | E2, A>
  935. /**
  936. * @category lifting
  937. * @since 2.0.0
  938. */
  939. export declare const fromPredicate: {
  940. <E, A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R = unknown>(
  941. a: A
  942. ) => ReaderTaskEither<R, E, B>
  943. <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R = unknown, B extends A = A>(
  944. b: B
  945. ) => ReaderTaskEither<R, E, B>
  946. <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R = unknown>(a: A) => ReaderTaskEither<R, E, A>
  947. }
  948. /**
  949. * @category filtering
  950. * @since 2.0.0
  951. */
  952. export declare const filterOrElse: {
  953. <E, A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(
  954. ma: ReaderTaskEither<R, E, A>
  955. ) => ReaderTaskEither<R, E, B>
  956. <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(
  957. mb: ReaderTaskEither<R, E, B>
  958. ) => ReaderTaskEither<R, E, B>
  959. <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  960. }
  961. /**
  962. * Less strict version of [`filterOrElse`](#filterorelse).
  963. *
  964. * The `W` suffix (short for **W**idening) means that the error types will be merged.
  965. *
  966. * @category filtering
  967. * @since 2.9.0
  968. */
  969. export declare const filterOrElseW: {
  970. <A, B extends A, E2>(refinement: Refinement<A, B>, onFalse: (a: A) => E2): <R, E1>(
  971. ma: ReaderTaskEither<R, E1, A>
  972. ) => ReaderTaskEither<R, E1 | E2, B>
  973. <A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <R, E1, B extends A>(
  974. mb: ReaderTaskEither<R, E1, B>
  975. ) => ReaderTaskEither<R, E1 | E2, B>
  976. <A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <R, E1>(
  977. ma: ReaderTaskEither<R, E1, A>
  978. ) => ReaderTaskEither<R, E1 | E2, A>
  979. }
  980. /**
  981. * @category lifting
  982. * @since 2.4.0
  983. */
  984. export declare const fromEitherK: <E, A extends ReadonlyArray<unknown>, B>(
  985. f: (...a: A) => E.Either<E, B>
  986. ) => <R = unknown>(...a: A) => ReaderTaskEither<R, E, B>
  987. /**
  988. * @category instances
  989. * @since 2.10.0
  990. */
  991. export declare const FromIO: FromIO3<URI>
  992. /**
  993. * @category lifting
  994. * @since 2.10.0
  995. */
  996. export declare const fromIOK: <A extends ReadonlyArray<unknown>, B>(
  997. f: (...a: A) => IO<B>
  998. ) => <R = unknown, E = never>(...a: A) => ReaderTaskEither<R, E, B>
  999. /**
  1000. * @category sequencing
  1001. * @since 2.10.0
  1002. */
  1003. export declare const chainIOK: <A, B>(
  1004. f: (a: A) => IO<B>
  1005. ) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  1006. /**
  1007. * @category sequencing
  1008. * @since 2.10.0
  1009. */
  1010. export declare const chainFirstIOK: <A, B>(
  1011. f: (a: A) => IO<B>
  1012. ) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  1013. /**
  1014. * @category instances
  1015. * @since 2.10.0
  1016. */
  1017. export declare const FromTask: FromTask3<URI>
  1018. /**
  1019. * @category lifting
  1020. * @since 2.10.0
  1021. */
  1022. export declare const fromTaskK: <A extends ReadonlyArray<unknown>, B>(
  1023. f: (...a: A) => T.Task<B>
  1024. ) => <R = unknown, E = never>(...a: A) => ReaderTaskEither<R, E, B>
  1025. /**
  1026. * @category sequencing
  1027. * @since 2.10.0
  1028. */
  1029. export declare const chainTaskK: <A, B>(
  1030. f: (a: A) => T.Task<B>
  1031. ) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>
  1032. /**
  1033. * @category sequencing
  1034. * @since 2.10.0
  1035. */
  1036. export declare const chainFirstTaskK: <A, B>(
  1037. f: (a: A) => T.Task<B>
  1038. ) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>
  1039. /**
  1040. * Make sure that a resource is cleaned up in the event of an exception (\*). The release action is called regardless of
  1041. * whether the body action throws (\*) or returns.
  1042. *
  1043. * (\*) i.e. returns a `Left`
  1044. *
  1045. * @since 2.0.4
  1046. */
  1047. export declare function bracket<R, E, A, B>(
  1048. acquire: ReaderTaskEither<R, E, A>,
  1049. use: (a: A) => ReaderTaskEither<R, E, B>,
  1050. release: (a: A, e: Either<E, B>) => ReaderTaskEither<R, E, void>
  1051. ): ReaderTaskEither<R, E, B>
  1052. /**
  1053. * Less strict version of [`bracket`](#bracket).
  1054. *
  1055. * @since 2.12.0
  1056. */
  1057. export declare function bracketW<R1, E1, A, R2, E2, B, R3, E3>(
  1058. acquire: ReaderTaskEither<R1, E1, A>,
  1059. use: (a: A) => ReaderTaskEither<R2, E2, B>,
  1060. release: (a: A, e: Either<E2, B>) => ReaderTaskEither<R3, E3, void>
  1061. ): ReaderTaskEither<R1 & R2 & R3, E1 | E2 | E3, B>
  1062. /**
  1063. * @category do notation
  1064. * @since 2.9.0
  1065. */
  1066. export declare const Do: ReaderTaskEither<unknown, never, {}>
  1067. /**
  1068. * @category do notation
  1069. * @since 2.8.0
  1070. */
  1071. export declare const bindTo: <N extends string>(
  1072. name: N
  1073. ) => <R, E, A>(fa: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, { readonly [K in N]: A }>
  1074. declare const let_: <N extends string, A, B>(
  1075. name: Exclude<N, keyof A>,
  1076. f: (a: A) => B
  1077. ) => <R, E>(
  1078. fa: ReaderTaskEither<R, E, A>
  1079. ) => ReaderTaskEither<R, E, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
  1080. export {
  1081. /**
  1082. * @category do notation
  1083. * @since 2.13.0
  1084. */
  1085. let_ as let
  1086. }
  1087. /**
  1088. * @category do notation
  1089. * @since 2.8.0
  1090. */
  1091. export declare const bind: <N extends string, A, R, E, B>(
  1092. name: Exclude<N, keyof A>,
  1093. f: (a: A) => ReaderTaskEither<R, E, B>
  1094. ) => (
  1095. ma: ReaderTaskEither<R, E, A>
  1096. ) => ReaderTaskEither<R, E, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
  1097. /**
  1098. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  1099. *
  1100. * @category do notation
  1101. * @since 2.8.0
  1102. */
  1103. export declare const bindW: <N extends string, A, R2, E2, B>(
  1104. name: Exclude<N, keyof A>,
  1105. f: (a: A) => ReaderTaskEither<R2, E2, B>
  1106. ) => <R1, E1>(
  1107. fa: ReaderTaskEither<R1, E1, A>
  1108. ) => ReaderTaskEither<
  1109. R1 & R2,
  1110. E1 | E2,
  1111. {
  1112. readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
  1113. }
  1114. >
  1115. /**
  1116. * @category do notation
  1117. * @since 2.8.0
  1118. */
  1119. export declare const apS: <N extends string, A, R, E, B>(
  1120. name: Exclude<N, keyof A>,
  1121. fb: ReaderTaskEither<R, E, B>
  1122. ) => (
  1123. fa: ReaderTaskEither<R, E, A>
  1124. ) => ReaderTaskEither<R, E, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
  1125. /**
  1126. * Less strict version of [`apS`](#aps).
  1127. *
  1128. * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
  1129. *
  1130. * @category do notation
  1131. * @since 2.8.0
  1132. */
  1133. export declare const apSW: <A, N extends string, R2, E2, B>(
  1134. name: Exclude<N, keyof A>,
  1135. fb: ReaderTaskEither<R2, E2, B>
  1136. ) => <R1, E1>(
  1137. fa: ReaderTaskEither<R1, E1, A>
  1138. ) => ReaderTaskEither<
  1139. R1 & R2,
  1140. E1 | E2,
  1141. {
  1142. readonly [K in keyof A | N]: K extends keyof A ? A[K] : B
  1143. }
  1144. >
  1145. /**
  1146. * @since 2.11.0
  1147. */
  1148. export declare const ApT: ReaderTaskEither<unknown, never, readonly []>
  1149. /**
  1150. * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativePar)`.
  1151. *
  1152. * @category traversing
  1153. * @since 2.11.0
  1154. */
  1155. export declare const traverseReadonlyNonEmptyArrayWithIndex: <A, R, E, B>(
  1156. f: (index: number, a: A) => ReaderTaskEither<R, E, B>
  1157. ) => (as: ReadonlyNonEmptyArray<A>) => ReaderTaskEither<R, E, ReadonlyNonEmptyArray<B>>
  1158. /**
  1159. * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativePar)`.
  1160. *
  1161. * @category traversing
  1162. * @since 2.11.0
  1163. */
  1164. export declare const traverseReadonlyArrayWithIndex: <A, R, E, B>(
  1165. f: (index: number, a: A) => ReaderTaskEither<R, E, B>
  1166. ) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>
  1167. /**
  1168. * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativeSeq)`.
  1169. *
  1170. * @category traversing
  1171. * @since 2.11.0
  1172. */
  1173. export declare const traverseReadonlyNonEmptyArrayWithIndexSeq: <A, R, E, B>(
  1174. f: (index: number, a: A) => ReaderTaskEither<R, E, B>
  1175. ) => (as: ReadonlyNonEmptyArray<A>) => ReaderTaskEither<R, E, ReadonlyNonEmptyArray<B>>
  1176. /**
  1177. * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.
  1178. *
  1179. * @category traversing
  1180. * @since 2.11.0
  1181. */
  1182. export declare const traverseReadonlyArrayWithIndexSeq: <A, R, E, B>(
  1183. f: (index: number, a: A) => ReaderTaskEither<R, E, B>
  1184. ) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>
  1185. /**
  1186. * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
  1187. *
  1188. * @category traversing
  1189. * @since 2.9.0
  1190. */
  1191. export declare const traverseArrayWithIndex: <R, E, A, B>(
  1192. f: (index: number, a: A) => ReaderTaskEither<R, E, B>
  1193. ) => (as: ReadonlyArray<A>) => ReaderTaskEither<R, E, ReadonlyArray<B>>
  1194. /**
  1195. * Equivalent to `ReadonlyArray#traverse(Applicative)`.
  1196. *
  1197. * @category traversing
  1198. * @since 2.9.0
  1199. */
  1200. export declare const traverseArray: <R, E, A, B>(
  1201. f: (a: A) => ReaderTaskEither<R, E, B>
  1202. ) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>
  1203. /**
  1204. * Equivalent to `ReadonlyArray#sequence(Applicative)`.
  1205. *
  1206. * @category traversing
  1207. * @since 2.9.0
  1208. */
  1209. export declare const sequenceArray: <R, E, A>(
  1210. arr: ReadonlyArray<ReaderTaskEither<R, E, A>>
  1211. ) => ReaderTaskEither<R, E, ReadonlyArray<A>>
  1212. /**
  1213. * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.
  1214. *
  1215. * @category traversing
  1216. * @since 2.9.0
  1217. */
  1218. export declare const traverseSeqArrayWithIndex: <R, E, A, B>(
  1219. f: (index: number, a: A) => ReaderTaskEither<R, E, B>
  1220. ) => (as: ReadonlyArray<A>) => ReaderTaskEither<R, E, ReadonlyArray<B>>
  1221. /**
  1222. * Equivalent to `ReadonlyArray#traverse(ApplicativeSeq)`.
  1223. *
  1224. * @category traversing
  1225. * @since 2.9.0
  1226. */
  1227. export declare const traverseSeqArray: <R, E, A, B>(
  1228. f: (a: A) => ReaderTaskEither<R, E, B>
  1229. ) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>
  1230. /**
  1231. * Equivalent to `ReadonlyArray#sequence(ApplicativeSeq)`.
  1232. *
  1233. * @category traversing
  1234. * @since 2.9.0
  1235. */
  1236. export declare const sequenceSeqArray: <R, E, A>(
  1237. arr: ReadonlyArray<ReaderTaskEither<R, E, A>>
  1238. ) => ReaderTaskEither<R, E, ReadonlyArray<A>>
  1239. /**
  1240. * This instance is deprecated, use small, specific instances instead.
  1241. * For example if a function needs a `Functor` instance, pass `RTE.Functor` instead of `RTE.readerTaskEither`
  1242. * (where `RTE` is from `import RTE from 'fp-ts/ReaderTaskEither'`)
  1243. *
  1244. * @category zone of death
  1245. * @since 2.0.0
  1246. * @deprecated
  1247. */
  1248. export declare const readerTaskEither: Monad3<URI> & Bifunctor3<URI> & Alt3<URI> & MonadTask3<URI> & MonadThrow3<URI>
  1249. /**
  1250. * This instance is deprecated, use small, specific instances instead.
  1251. * For example if a function needs a `Functor` instance, pass `RTE.Functor` instead of `RTE.readerTaskEitherSeq`
  1252. * (where `RTE` is from `import RTE from 'fp-ts/ReaderTaskEither'`)
  1253. *
  1254. * @category zone of death
  1255. * @since 2.0.0
  1256. * @deprecated
  1257. */
  1258. export declare const readerTaskEitherSeq: typeof readerTaskEither
  1259. /**
  1260. * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
  1261. *
  1262. * Semigroup returning the left-most `Left` value. If both operands are `Right`s then the inner values
  1263. * are concatenated using the provided `Semigroup`
  1264. *
  1265. * @category zone of death
  1266. * @since 2.0.0
  1267. * @deprecated
  1268. */
  1269. export declare const getApplySemigroup: <R, E, A>(S: Semigroup<A>) => Semigroup<ReaderTaskEither<R, E, A>>
  1270. /**
  1271. * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.
  1272. *
  1273. * @category zone of death
  1274. * @since 2.0.0
  1275. * @deprecated
  1276. */
  1277. export declare const getApplyMonoid: <R, E, A>(M: Monoid<A>) => Monoid<ReaderTaskEither<R, E, A>>
  1278. /**
  1279. * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
  1280. *
  1281. * @category zone of death
  1282. * @since 2.0.0
  1283. * @deprecated
  1284. */
  1285. export declare const getSemigroup: <R, E, A>(S: Semigroup<A>) => Semigroup<ReaderTaskEither<R, E, A>>
  1286. /**
  1287. * Use [`getApplicativeReaderTaskValidation`](#getapplicativereadertaskvalidation) and [`getAltReaderTaskValidation`](#getaltreadertaskvalidation) instead.
  1288. *
  1289. * @category instances
  1290. * @since 2.3.0
  1291. * @deprecated
  1292. */
  1293. export declare function getReaderTaskValidation<E>(
  1294. SE: Semigroup<E>
  1295. ): Monad3C<URI, E> & Bifunctor3<URI> & Alt3C<URI, E> & MonadTask3C<URI, E> & MonadThrow3C<URI, E>
  1296. /**
  1297. * @category zone of death
  1298. * @since 2.0.0
  1299. * @deprecated
  1300. */
  1301. export declare function run<R, E, A>(ma: ReaderTaskEither<R, E, A>, r: R): Promise<Either<E, A>>