版博士V2.0程序
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * The `Monad` type class combines the operations of the `Chain` and
  3. * `Applicative` type classes. Therefore, `Monad` instances represent type
  4. * constructors which support sequential composition, and also lifting of
  5. * functions of arbitrary arity.
  6. *
  7. * Instances must satisfy the following laws in addition to the `Applicative` and `Chain` laws:
  8. *
  9. * 1. Left identity: `M.chain(M.of(a), f) <-> f(a)`
  10. * 2. Right identity: `M.chain(fa, M.of) <-> fa`
  11. *
  12. * Note. `Functor`'s `map` can be derived: `A.map = (fa, f) => A.chain(fa, a => A.of(f(a)))`
  13. *
  14. * @since 2.0.0
  15. */
  16. import {
  17. Applicative,
  18. Applicative1,
  19. Applicative2,
  20. Applicative2C,
  21. Applicative3,
  22. Applicative3C,
  23. Applicative4
  24. } from './Applicative'
  25. import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C, Chain4 } from './Chain'
  26. import { URIS, URIS2, URIS3, URIS4 } from './HKT'
  27. /**
  28. * @category model
  29. * @since 2.0.0
  30. */
  31. export interface Monad<F> extends Applicative<F>, Chain<F> {}
  32. /**
  33. * @category model
  34. * @since 2.0.0
  35. */
  36. export interface Monad1<F extends URIS> extends Applicative1<F>, Chain1<F> {}
  37. /**
  38. * @category model
  39. * @since 2.0.0
  40. */
  41. export interface Monad2<M extends URIS2> extends Applicative2<M>, Chain2<M> {}
  42. /**
  43. * @category model
  44. * @since 2.0.0
  45. */
  46. export interface Monad2C<M extends URIS2, L> extends Applicative2C<M, L>, Chain2C<M, L> {}
  47. /**
  48. * @category model
  49. * @since 2.0.0
  50. */
  51. export interface Monad3<M extends URIS3> extends Applicative3<M>, Chain3<M> {}
  52. /**
  53. * @category model
  54. * @since 2.2.0
  55. */
  56. export interface Monad3C<M extends URIS3, E> extends Applicative3C<M, E>, Chain3C<M, E> {}
  57. /**
  58. * @category model
  59. * @since 2.0.0
  60. */
  61. export interface Monad4<M extends URIS4> extends Applicative4<M>, Chain4<M> {}