UNPKG

1.42 kBTypeScriptView Raw
1/**
2 * **This module is experimental**
3 *
4 * Experimental features are published in order to get early feedback from the community, see these tracking
5 * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements.
6 *
7 * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.
8 *
9 * @since 2.2.7
10 */
11import { Semigroup } from 'fp-ts/lib/Semigroup'
12/**
13 * @category model
14 * @since 2.2.7
15 */
16export interface Of<A> {
17 readonly _tag: 'Of'
18 readonly value: A
19}
20/**
21 * @category model
22 * @since 2.2.7
23 */
24export interface Concat<A> {
25 readonly _tag: 'Concat'
26 readonly left: FreeSemigroup<A>
27 readonly right: FreeSemigroup<A>
28}
29/**
30 * @category model
31 * @since 2.2.7
32 */
33export declare type FreeSemigroup<A> = Of<A> | Concat<A>
34/**
35 * @category constructors
36 * @since 2.2.7
37 */
38export declare const of: <A>(a: A) => FreeSemigroup<A>
39/**
40 * @category constructors
41 * @since 2.2.7
42 */
43export declare const concat: <A>(left: FreeSemigroup<A>, right: FreeSemigroup<A>) => FreeSemigroup<A>
44/**
45 * @category destructors
46 * @since 2.2.7
47 */
48export declare const fold: <A, R>(
49 onOf: (value: A) => R,
50 onConcat: (left: FreeSemigroup<A>, right: FreeSemigroup<A>) => R
51) => (f: FreeSemigroup<A>) => R
52/**
53 * @category instances
54 * @since 2.2.7
55 */
56export declare function getSemigroup<A = never>(): Semigroup<FreeSemigroup<A>>
57
\No newline at end of file