Show overview

Added in v2.0.0


Table of contents


Show (interface)

The Show type class represents those types which can be converted into a human-readable string representation.

While not required, it is recommended that for any expression x, the string show(x) be executable TypeScript code which evaluates to the same value as the expression x.

Signature

export interface Show<A> {
  readonly show: (a: A) => string
}

Added in v2.0.0

getStructShow

Signature

export function getStructShow<O extends ReadonlyRecord<string, any>>(shows: { [K in keyof O]: Show<O[K]> }): Show<O> { ... }

Added in v2.0.0

getTupleShow

Signature

export function getTupleShow<T extends ReadonlyArray<Show<any>>>(
  ...shows: T
): Show<{ [K in keyof T]: T[K] extends Show<infer A> ? A : never }> { ... }

Added in v2.0.0

showBoolean

Signature

export const showBoolean: Show<boolean> = ...

Added in v2.0.0

showNumber

Signature

export const showNumber: Show<number> = ...

Added in v2.0.0

showString

Signature

export const showString: Show<string> = ...

Added in v2.0.0