import type * as P from "@principia/prelude"; import * as HKT from "@principia/prelude/HKT"; import * as X from "../XPure"; import type { IO, URI, V } from "./model"; /* * ------------------------------------------- * Functor IO * ------------------------------------------- */ /** * ```haskell * map_ :: Functor f => (f a, (a -> b)) -> f b * ``` * * Lifts a function a -> b to a function f a -> f b * * @category Functor * @since 1.0.0 */ export const map_: (fa: IO, f: (a: A) => B) => IO = X.map_; /** * ```haskell * map :: Functor f => (a -> b) -> f a -> f b * ``` * * Lifts a function a -> b to a function f a -> f b * * @category Functor * @since 1.0.0 */ export const map = (f: (a: A) => B) => (fa: IO): IO => map_(fa, f); export const Functor: P.Functor<[URI], V> = HKT.instance({ map_: map_, map });