import type * as P from "@principia/prelude"; import * as HKT from "@principia/prelude/HKT"; import * as A from "../Array"; import { Functor } from "./functor"; import type { NonEmptyArray, URI, V } from "./model"; import { unit } from "./unit"; /* * ------------------------------------------- * Applicative NonEmptyArray * ------------------------------------------- */ export const zip_: (fa: NonEmptyArray, fb: NonEmptyArray) => NonEmptyArray = A.zip_ as any; export const zip: ( fb: NonEmptyArray ) => (fa: NonEmptyArray) => NonEmptyArray = A.zip as any; /** * ```haskell * pure :: a -> NonEmptyArray a * ``` * * Lifts a value into a `NonEmptyArray` * * @category Applicative * @since 1.0.0 */ export const pure = (a: A): NonEmptyArray => [a]; export const Applicative: P.Applicative<[URI], V> = HKT.instance({ ...Functor, both_: zip_, both: zip, unit });