Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Sep 14, 2020
1 parent bd0a2d5 commit 20a0dda
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 137 deletions.
18 changes: 9 additions & 9 deletions docs/modules/Align/Array.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export declare const lpadZip: <A, B>(xs: A[], ys: B[]) => [Option<A>, B][]
**Example**
```ts
import { some, none } from 'fp-ts/lib/Option'
import { lpadZip } from 'fp-ts-contrib/lib/Align/Array'
import { some, none } from 'fp-ts/Option'
import { lpadZip } from 'fp-ts-contrib/Align/Array'

assert.deepStrictEqual(lpadZip([1, 2], ['a', 'b', 'c']), [
[some(1), 'a'],
Expand Down Expand Up @@ -83,9 +83,9 @@ export declare const lpadZipWith: <A, B, C>(xs: A[], ys: B[], f: (a: Option<A>,
**Example**
```ts
import * as O from 'fp-ts/lib/Option'
import { lpadZipWith } from 'fp-ts-contrib/lib/Align/Array'
import { pipe } from 'fp-ts/lib/pipeable'
import * as O from 'fp-ts/Option'
import { lpadZipWith } from 'fp-ts-contrib/Align/Array'
import { pipe } from 'fp-ts/function'

const f = (ma: O.Option<number>, b: string) =>
pipe(
Expand Down Expand Up @@ -117,8 +117,8 @@ export declare const rpadZip: <A, B>(xs: A[], ys: B[]) => [A, Option<B>][]
**Example**
```ts
import { some, none } from 'fp-ts/lib/Option'
import { rpadZip } from 'fp-ts-contrib/lib/Align/Array'
import { some, none } from 'fp-ts/Option'
import { rpadZip } from 'fp-ts-contrib/Align/Array'

assert.deepStrictEqual(rpadZip([1, 2, 3], ['a', 'b']), [
[1, some('a')],
Expand Down Expand Up @@ -149,8 +149,8 @@ export declare const rpadZipWith: <A, B, C>(xs: A[], ys: B[], f: (a: A, b: Optio
**Example**
```ts
import { Option, getOrElse } from 'fp-ts/lib/Option'
import { rpadZipWith } from 'fp-ts-contrib/lib/Align/Array'
import { Option, getOrElse } from 'fp-ts/Option'
import { rpadZipWith } from 'fp-ts-contrib/Align/Array'

const f = (a: number, mb: Option<string>) => a.toString() + getOrElse(() => '*')(mb)
assert.deepStrictEqual(rpadZipWith([1, 2, 3, 4], ['a', 'b', 'c'], f), ['1a', '2b', '3c', '4*'])
Expand Down
20 changes: 10 additions & 10 deletions docs/modules/Align/index.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ export declare function padZip<F>(F: Align<F>): <A, B>(fa: HKT<F, A>, fb: HKT<F,
**Example**

```ts
import { some, none } from 'fp-ts/lib/Option'
import { padZip } from 'fp-ts-contrib/lib/Align'
import { alignArray } from 'fp-ts-contrib/lib/Align/Array'
import { some, none } from 'fp-ts/Option'
import { padZip } from 'fp-ts-contrib/Align'
import { alignArray } from 'fp-ts-contrib/Align/Array'
assert.deepStrictEqual(padZip(alignArray)([1, 2, 3], [4, 5]), [
[some(1), some(4)],
Expand Down Expand Up @@ -169,10 +169,10 @@ export declare function padZipWith<F>(
**Example**

```ts
import { Option, fold, getOrElse } from 'fp-ts/lib/Option'
import { padZipWith } from 'fp-ts-contrib/lib/Align'
import { alignArray } from 'fp-ts-contrib/lib/Align/Array'
import { pipe } from 'fp-ts/lib/pipeable'
import { Option, fold, getOrElse } from 'fp-ts/Option'
import { padZipWith } from 'fp-ts-contrib/Align'
import { alignArray } from 'fp-ts-contrib/Align/Array'
import { pipe } from 'fp-ts/function'
const f = (ma: Option<number>, mb: Option<string>) =>
pipe(
Expand Down Expand Up @@ -222,9 +222,9 @@ export declare function salign<F, A>(F: Align<F>, S: Semigroup<A>): (fx: HKT<F,
**Example**

```ts
import { semigroupSum } from 'fp-ts/lib/Semigroup'
import { salign } from 'fp-ts-contrib/lib/Align'
import { alignArray } from 'fp-ts-contrib/lib/Align/Array'
import { semigroupSum } from 'fp-ts/Semigroup'
import { salign } from 'fp-ts-contrib/Align'
import { alignArray } from 'fp-ts-contrib/Align/Array'
assert.deepStrictEqual(salign(alignArray, semigroupSum)([1, 2, 3], [4, 5]), [5, 7, 3])
```
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/Do.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export declare function Do<M>(M: Monad<M>): Do0<M, {}>
**Example**

```ts
import { option, some } from 'fp-ts/lib/Option'
import { Do } from 'fp-ts-contrib/lib/Do'
import { option, some } from 'fp-ts/Option'
import { Do } from 'fp-ts-contrib/Do'
// x: Option<number>
const x = Do(option) // <- a monad instance
Expand Down
38 changes: 19 additions & 19 deletions docs/modules/List.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export declare const of: <A>(head: A) => List<A>
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.of('a'), L.cons('a', L.nil))
```
Expand Down Expand Up @@ -150,7 +150,7 @@ export declare const dropLeft: (n: number) => <A>(fa: List<A>) => List<A>
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.dropLeft(1)(L.nil), L.nil)
assert.deepStrictEqual(L.dropLeft(1)(L.cons(1, L.of(2))), L.of(2))
Expand All @@ -172,7 +172,7 @@ export declare const reverse: <A>(fa: List<A>) => List<A>
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.reverse(L.cons(1, L.cons(2, L.of(3)))), L.cons(3, L.cons(2, L.of(1))))
```
Expand All @@ -194,7 +194,7 @@ export declare const cons: <A>(head: A, tail: List<A>) => List<A>
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.cons('a', L.nil), { type: 'Cons', head: 'a', tail: L.nil, length: 1 })
```
Expand All @@ -214,7 +214,7 @@ export declare const fromArray: <A>(as: A[]) => List<A>
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.fromArray([]), L.nil)
assert.deepStrictEqual(L.fromArray(['a', 'b']), L.cons('a', L.of('b')))
Expand Down Expand Up @@ -247,7 +247,7 @@ export declare const foldLeft: <A, B>(onNil: () => B, onCons: (head: A, tail: Li
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

const len: <A>(as: L.List<A>) => number = L.foldLeft(
() => 0,
Expand All @@ -271,8 +271,8 @@ export declare const head: <A>(fa: List<A>) => O.Option<A>
**Example**
```ts
import * as O from 'fp-ts/lib/Option'
import * as L from 'fp-ts-contrib/lib/List'
import * as O from 'fp-ts/Option'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.head(L.nil), O.none)
assert.deepStrictEqual(L.head(L.cons('x', L.of('a'))), O.some('x'))
Expand All @@ -293,8 +293,8 @@ export declare const tail: <A>(fa: List<A>) => O.Option<List<A>>
**Example**
```ts
import * as O from 'fp-ts/lib/Option'
import * as L from 'fp-ts-contrib/lib/List'
import * as O from 'fp-ts/Option'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.tail(L.nil), O.none)
assert.deepStrictEqual(L.tail(L.of('a')), O.some(L.nil))
Expand All @@ -316,7 +316,7 @@ export declare const toArray: <A>(fa: List<A>) => A[]
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.toArray(L.cons('a', L.of('b'))), ['a', 'b'])
```
Expand All @@ -336,7 +336,7 @@ export declare const toReversedArray: <A>(fa: List<A>) => A[]
**Example**
```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'

assert.deepStrictEqual(L.toReversedArray(L.cons('a', L.of('b'))), ['b', 'a'])
```
Expand Down Expand Up @@ -411,8 +411,8 @@ export declare const getEq: <A>(E: Eq.Eq<A>) => Eq.Eq<List<A>>
**Example**
```ts
import { eqString } from 'fp-ts/lib/Eq'
import * as L from 'fp-ts-contrib/lib/List'
import { eqString } from 'fp-ts/Eq'
import * as L from 'fp-ts-contrib/List'

const E = L.getEq(eqString)
assert.strictEqual(E.equals(L.cons('a', L.of('b')), L.cons('a', L.of('b'))), true)
Expand Down Expand Up @@ -487,7 +487,7 @@ export declare function dropLeftWhile<A>(predicate: Predicate<A>): (fa: List<A>)
**Example**

```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'
const isLTThree = (n: number) => n < 3
assert.deepStrictEqual(L.dropLeftWhile(isLTThree)(L.nil), L.nil)
Expand All @@ -510,8 +510,8 @@ export declare const findIndex: <A>(predicate: Predicate<A>) => (fa: List<A>) =>
**Example**

```ts
import * as O from 'fp-ts/lib/Option'
import * as L from 'fp-ts-contrib/lib/List'
import * as O from 'fp-ts/Option'
import * as L from 'fp-ts-contrib/List'
const f = (a: number): boolean => a % 2 === 0
const findIndexEven = L.findIndex(f)
Expand All @@ -535,7 +535,7 @@ export declare const isCons: <A>(a: List<A>) => a is Cons<A>
**Example**

```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'
assert.strictEqual(L.isCons(L.nil), false)
assert.strictEqual(L.isCons(L.of(1)), true)
Expand All @@ -556,7 +556,7 @@ export declare const isNil: <A>(a: List<A>) => a is Nil
**Example**

```ts
import * as L from 'fp-ts-contrib/lib/List'
import * as L from 'fp-ts-contrib/List'
assert.strictEqual(L.isNil(L.nil), true)
assert.strictEqual(L.isNil(L.of(6)), false)
Expand Down
12 changes: 6 additions & 6 deletions docs/modules/RegExp.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export declare const match: (r: RegExp) => (s: string) => O.Option<RegExpMatchAr
**Example**
```ts
import * as O from 'fp-ts/lib/Option'
import { match } from 'fp-ts-contrib/lib/RegExp'
import { pipe } from 'fp-ts/lib/pipeable'
import * as O from 'fp-ts/Option'
import { match } from 'fp-ts-contrib/RegExp'
import { pipe } from 'fp-ts/function'

const myMatch = match(/^(\d)(\w)$/)
assert.deepStrictEqual(pipe('2e', myMatch, O.map(Array.from)), O.some(['2e', '2', 'e']))
Expand All @@ -64,7 +64,7 @@ export declare const split: (r: RegExp) => (s: string) => NonEmptyArray<string>
**Example**
```ts
import { split } from 'fp-ts-contrib/lib/RegExp'
import { split } from 'fp-ts-contrib/RegExp'

const splitByHash = split(/#/)
assert.deepStrictEqual(splitByHash('foo#bar#beer'), ['foo', 'bar', 'beer'])
Expand All @@ -87,7 +87,7 @@ export declare const sub: (r: RegExp, replacement: string) => (s: string) => str
**Example**
```ts
import { sub } from 'fp-ts-contrib/lib/RegExp'
import { sub } from 'fp-ts-contrib/RegExp'

const sanitiseSpaces = sub(/\s/g, '_')
assert.strictEqual(sanitiseSpaces('foo bar owl'), 'foo_bar_owl')
Expand All @@ -109,7 +109,7 @@ export declare const test: (r: RegExp) => Predicate<string>
**Example**
```ts
import { test } from 'fp-ts-contrib/lib/RegExp'
import { test } from 'fp-ts-contrib/RegExp'

const myTest = test(/^(\d)(\w)$/)
assert.strictEqual(myTest('6s'), true)
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/Task/withTimeout.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export declare const withTimeout: <A>(onTimeout: A, millis: number) => (ma: Task
**Example**
```ts
import { withTimeout } from 'fp-ts-contrib/lib/Task/withTimeout'
import { delay, of } from 'fp-ts/lib/Task'
import { withTimeout } from 'fp-ts-contrib/Task/withTimeout'
import { delay, of } from 'fp-ts/Task'

const completeAfter2s = delay(2000)(of('result'))

Expand Down
12 changes: 6 additions & 6 deletions docs/modules/collectUntil.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export declare function collectUntil<M, F>(
**Example**

```ts
import { array } from 'fp-ts/lib/Array'
import * as E from 'fp-ts/lib/Either'
import { flow } from 'fp-ts/lib/function'
import * as O from 'fp-ts/lib/Option'
import * as TE from 'fp-ts/lib/TaskEither'
import { collectUntil } from 'fp-ts-contrib/lib/collectUntil'
import { array } from 'fp-ts/Array'
import * as E from 'fp-ts/Either'
import { flow } from 'fp-ts/function'
import * as O from 'fp-ts/Option'
import * as TE from 'fp-ts/TaskEither'
import { collectUntil } from 'fp-ts-contrib/collectUntil'
interface Page {
rows: Array<string>
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/filterA.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export declare function filterA<F>(
**Example**

```ts
import { io, IO } from 'fp-ts/lib/IO'
import { filterA } from 'fp-ts-contrib/lib/filterA'
import { io, IO } from 'fp-ts/IO'
import { filterA } from 'fp-ts-contrib/filterA'
const filterAIO = filterA(io)
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/time.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export declare function time<M>(M: MonadIO<M>): <A>(ma: HKT<M, A>) => HKT<M, [A,
**Example**

```ts
import { io } from 'fp-ts/lib/IO'
import { randomInt } from 'fp-ts/lib/Random'
import { time } from 'fp-ts-contrib/lib/time'
import { io } from 'fp-ts/IO'
import { randomInt } from 'fp-ts/Random'
import { time } from 'fp-ts-contrib/time'
const timeIO = time(io)
Expand Down
Loading

0 comments on commit 20a0dda

Please sign in to comment.