Show overview

Utilities to accommodate fp-ts/Show.

Added in v0.12.0


Table of contents


1 Typeclass Instances

Contravariant

Formal Contravariant instance for Show to be provided to higher-kinded functions that require it.

Signature

export declare const Contravariant: Contravariant1<'Show'>
Contravariant :: Contravariant1 "Show"

Added in v0.12.0

2 Typeclass Methods

contramap

Derive an instance for Show<B> by providing a function from B to A and a Show<A> instance.

Signature

export declare const contramap: <B, A>(f: (b: B) => A) => (m: Show<A>) => Show<B>
contramap :: (b -> a) -> Show a -> Show b

Example

import { Show } from 'fp-ts/Show'
import * as Str from 'fp-ts/string'
import { contramap } from 'fp-ts-std/Show'

const showNum: Show<number> = contramap(String)(Str.Show)

assert.strictEqual(showNum.show(123), '"123"')

Added in v0.12.0

4 Minutiae

URI

Typeclass machinery.

Signature

export declare const URI: 'Show'
URI :: "Show"

Added in v0.12.0

URI (type alias)

Typeclass machinery.

Signature

export type URI = typeof URI
type URI = typeof URI

Added in v0.12.0