Skip to content

Commit

Permalink
POC: FreeDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Jun 29, 2020
1 parent 29d3c38 commit b2b52ec
Show file tree
Hide file tree
Showing 21 changed files with 648 additions and 31 deletions.
116 changes: 116 additions & 0 deletions docs/modules/DecoderError.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
title: DecoderError.ts
nav_order: 3
parent: Modules
---

## DecoderError overview

Added in v2.2.7

---

<h2 class="text-delta">Table of contents</h2>

- [constructors](#constructors)
- [leaf](#leaf)
- [required](#required)
- [destructors](#destructors)
- [fold](#fold)
- [instances](#instances)
- [getSemigroup](#getsemigroup)
- [model](#model)
- [DecodeError (type alias)](#decodeerror-type-alias)
- [Leaf (interface)](#leaf-interface)
- [Required (interface)](#required-interface)

---

# constructors

## leaf

**Signature**

```ts
export declare const leaf: (input: unknown, error: string) => DecodeError
```
Added in v2.2.7
## required
**Signature**
```ts
export declare const required: (key: string, errors: FS.FreeSemigroup<DecodeError>) => DecodeError
```
Added in v2.2.7
# destructors
## fold
**Signature**
```ts
export declare const fold: <R>(patterns: {
Leaf: (input: unknown, error: string) => R
Required: (k: string, errors: FS.FreeSemigroup<DecodeError>) => R
}) => (e: DecodeError) => R
```
Added in v2.2.7
# instances
## getSemigroup
**Signature**
```ts
export declare function getSemigroup(): Semigroup<FS.FreeSemigroup<DecodeError>>
```

Added in v2.2.7

# model

## DecodeError (type alias)

**Signature**

```ts
export type DecodeError = Leaf | Required
```

Added in v2.2.7

## Leaf (interface)

**Signature**

```ts
export interface Leaf {
readonly _tag: 'Leaf'
readonly input: unknown
readonly error: string
}
```

Added in v2.2.7

## Required (interface)

**Signature**

```ts
export interface Required {
readonly _tag: 'Required'
readonly key: string
readonly errors: FS.FreeSemigroup<DecodeError>
}
```

Added in v2.2.7
2 changes: 1 addition & 1 deletion docs/modules/DecoderT.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: DecoderT.ts
nav_order: 3
nav_order: 4
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Encoder.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Encoder.ts
nav_order: 4
nav_order: 5
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Eq.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Eq.ts
nav_order: 5
nav_order: 6
parent: Modules
---

Expand Down
87 changes: 87 additions & 0 deletions docs/modules/FreeDecoder.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: FreeDecoder.ts
nav_order: 7
parent: Modules
---

## FreeDecoder overview

Added in v2.2.7

---

<h2 class="text-delta">Table of contents</h2>

- [utils](#utils)
- [FreeDecoder (interface)](#freedecoder-interface)
- [UnknownRecord](#unknownrecord)
- [number](#number)
- [string](#string)
- [toForest](#toforest)
- [type](#type)

---

# utils

## FreeDecoder (interface)

**Signature**

```ts
export interface FreeDecoder<A> extends DT.DecoderT<E.URI, FS.FreeSemigroup<DE.DecodeError>, A> {}
```

Added in v2.2.7

## UnknownRecord

**Signature**

```ts
export declare const UnknownRecord: FreeDecoder<Record<string, unknown>>
```
Added in v2.2.7
## number
**Signature**
```ts
export declare const number: FreeDecoder<number>
```
Added in v2.2.7
## string
**Signature**
```ts
export declare const string: FreeDecoder<string>
```
Added in v2.2.7
## toForest
**Signature**
```ts
export declare function toForest(s: FS.FreeSemigroup<DE.DecodeError>): NEA.NonEmptyArray<T.Tree<string>>
```

Added in v2.2.7

## type

**Signature**

```ts
export declare const type: <A>(
properties: { [K in keyof A]: FreeDecoder<A[K]> }
) => FreeDecoder<{ [K in keyof A]: A[K] }>
```

Added in v2.2.7
115 changes: 115 additions & 0 deletions docs/modules/FreeSemigroup.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: FreeSemigroup.ts
nav_order: 8
parent: Modules
---

## FreeSemigroup overview

Added in v2.2.7

---

<h2 class="text-delta">Table of contents</h2>

- [consrtuctors](#consrtuctors)
- [concat](#concat)
- [of](#of)
- [destructors](#destructors)
- [fold](#fold)
- [instances](#instances)
- [getSemigroup](#getsemigroup)
- [model](#model)
- [Concat (interface)](#concat-interface)
- [FreeSemigroup (type alias)](#freesemigroup-type-alias)
- [Of (interface)](#of-interface)

---

# consrtuctors

## concat

**Signature**

```ts
export declare const concat: <A>(left: FreeSemigroup<A>, right: FreeSemigroup<A>) => FreeSemigroup<A>
```
Added in v2.2.7
## of
**Signature**
```ts
export declare const of: <A>(a: A) => FreeSemigroup<A>
```
Added in v2.2.7
# destructors
## fold
**Signature**
```ts
export declare const fold: <A, R>(
onOf: (value: A) => R,
onConcat: (left: FreeSemigroup<A>, right: FreeSemigroup<A>) => R
) => (f: FreeSemigroup<A>) => R
```
Added in v2.2.7
# instances
## getSemigroup
**Signature**
```ts
export declare function getSemigroup<A = never>(): Semigroup<FreeSemigroup<A>>
```

Added in v2.2.7

# model

## Concat (interface)

**Signature**

```ts
export interface Concat<A> {
readonly _tag: 'Concat'
readonly left: FreeSemigroup<A>
readonly right: FreeSemigroup<A>
}
```

Added in v2.2.7

## FreeSemigroup (type alias)

**Signature**

```ts
export type FreeSemigroup<A> = Of<A> | Concat<A>
```

Added in v2.2.7

## Of (interface)

**Signature**

```ts
export interface Of<A> {
readonly _tag: 'Of'
readonly value: A
}
```

Added in v2.2.7
2 changes: 1 addition & 1 deletion docs/modules/Guard.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Guard.ts
nav_order: 6
nav_order: 9
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/JsonCodec.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: JsonCodec.ts
nav_order: 8
nav_order: 11
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/JsonEncoder.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: JsonEncoder.ts
nav_order: 9
nav_order: 12
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/PathReporter.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: PathReporter.ts
nav_order: 10
nav_order: 13
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Reporter.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Reporter.ts
nav_order: 11
nav_order: 14
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Schema.ts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Schema.ts
nav_order: 12
nav_order: 15
parent: Modules
---

Expand Down
Loading

0 comments on commit b2b52ec

Please sign in to comment.