Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f7ef682
Add Map module, getMapSemigroup, getMapMonoid, & tests
joshburgess Feb 10, 2019
e3e9b09
Merge branch 'master' of github.com:gcanti/fp-ts
joshburgess Feb 10, 2019
17334d2
Remove accidentally left in comments & re-run test script
joshburgess Feb 10, 2019
438ae92
Replace deepEqual with deepStrictEqual in tests
joshburgess Feb 10, 2019
eee944e
Fix traverseWithKey Map test
joshburgess Feb 10, 2019
1fef2cf
Add tests for keys and unsafeLookup
joshburgess Feb 10, 2019
6f3971c
Remove testURL option & update Jest
joshburgess Feb 11, 2019
1c159ce
Address PR feedback -- WIP (need to update tests)
joshburgess Feb 11, 2019
c304e2b
Update fromFoldable to use Setoid<K>
joshburgess Feb 11, 2019
0889930
Update collect to use lookupWithKey
joshburgess Feb 11, 2019
a0c7574
Address 2nd round of PR feedback (still need to update tests)
joshburgess Feb 12, 2019
3349d9f
Rename member to has & add separate member function
joshburgess Feb 12, 2019
b436e54
Rearrange grouped generics & type class constraints
joshburgess Feb 14, 2019
a75e379
Replace Map's member with isMember
joshburgess Feb 14, 2019
0b6c84b
Remove unused fromNullable from imports
joshburgess Feb 14, 2019
e6ca597
Fix Map's getMonoid test
joshburgess Feb 14, 2019
73e36d0
Fix type errors in Map tests file
joshburgess Feb 14, 2019
9a7c3c2
Remove getMapMonoid from Monoid tests file
joshburgess Feb 14, 2019
5a4068a
Remove getMapSemigroup from Semigroup tests file
joshburgess Feb 14, 2019
b03a295
Update isMember
joshburgess Feb 14, 2019
04734a9
Rewrite reduce, reduceWithKey, foldr, & foldrWithKey using Ords
joshburgess Feb 14, 2019
d1559ba
Merge branch 'master' of github.com:gcanti/fp-ts
joshburgess Feb 14, 2019
1888737
Add alternate keys_ function that returns a Set
joshburgess Feb 14, 2019
5c57c25
Fix remove implementation
joshburgess Feb 14, 2019
cc0942d
Add tests for isSubmap and empty
joshburgess Feb 14, 2019
4b4358e
Rearrange tests, add missing tests, add Jest --clearCache flag
joshburgess Feb 14, 2019
587b934
Rename keys_ to keysSet and simplify its implementation
joshburgess Feb 14, 2019
57c384d
Add extra conditional check in isMember to return early
joshburgess Feb 14, 2019
348f4f0
Remove out var in isMember
joshburgess Feb 15, 2019
d75ff67
Fix isMember implementation
joshburgess Feb 15, 2019
4c4bc6a
Fix foldMap & foldMapWithKey by giving them an Ord<K> constraint
joshburgess Feb 15, 2019
1696c36
Fix _WithIndex vs _WithKey inconsistency -- fixed in Record in separa…
joshburgess Feb 15, 2019
cf6d05c
Merge branch 'master' of github.com:gcanti/fp-ts
joshburgess Feb 16, 2019
f1a7026
Add Map instances, instance getter functions, & related
joshburgess Feb 16, 2019
21afce2
Delete unused imports
joshburgess Feb 16, 2019
80a42b9
Cleanup/rearrange tests
joshburgess Feb 16, 2019
6dd77e7
Address half of new round of PR review requested changes
joshburgess Feb 16, 2019
51c1bd4
Fix isSubmap
joshburgess Feb 16, 2019
69c2488
Revert changes to isSubmap and remove unnecesssary lookup
joshburgess Feb 16, 2019
0fa8710
Remove unnecessary lookup in getMonoid
joshburgess Feb 16, 2019
d5b1dbf
Change fromFoldable to use Foldable2v instead
joshburgess Feb 16, 2019
9d5085a
Remove unused imports
joshburgess Feb 16, 2019
bfade2b
Move jest --clearCache into a separate npm script
joshburgess Feb 16, 2019
6f48ab3
Attempt to fix test coverage (failed)
joshburgess Feb 16, 2019
e86d7e0
Fix test mitsake
joshburgess Feb 16, 2019
874e5b8
Remove overloads
joshburgess Feb 16, 2019
d046fd2
Fix fromFoldable implementation
joshburgess Feb 17, 2019
c0f241e
Change which instance getters are made public
joshburgess Feb 17, 2019
279e3b7
Change getMonoid implementation
joshburgess Feb 17, 2019
c41f56a
Obtain 100% test coverage) still need better Ord/Setoid usage
joshburgess Feb 17, 2019
255ed60
Completely overhaul tests & fix keysSet implementation
joshburgess Feb 18, 2019
5547636
Replace Array sort dependency with native sort + O.compare
joshburgess Feb 18, 2019
f277cee
Rerwrite keysSet implementation without Set's fromArray dependency
joshburgess Feb 18, 2019
b5e9141
Improve keys test + add and test values & valuesSet
joshburgess Feb 18, 2019
af8a2c5
Add elemKey and test
joshburgess Feb 18, 2019
2f72dd2
Add elemPair + use it in elemKey & isMember
joshburgess Feb 18, 2019
ac87ca9
Adjust comments
joshburgess Feb 18, 2019
137ac2c
Rename isMember to elem
joshburgess Feb 18, 2019
9eef791
Rename has to member
joshburgess Feb 18, 2019
4faba5b
Add missing test for elemPair
joshburgess Feb 18, 2019
8594794
Fix comment for elemPair
joshburgess Feb 18, 2019
2467bc4
Rename elemPair to elemWithKey
joshburgess Feb 18, 2019
d471a17
Add & test new toSet function
joshburgess Feb 18, 2019
1764e8d
Minor cleanup of tests
joshburgess Feb 18, 2019
e3e929e
Remove elemKey, elemWithKey, toSet, keysSet, & valuesSet
joshburgess Feb 19, 2019
22afbb6
Merge branch 'master' of github.com:gcanti/fp-ts
joshburgess Feb 19, 2019
2e4a13d
Update dtslint
joshburgess Feb 19, 2019
204e2ac
Attempt to fix dtslint package lock problem
joshburgess Feb 19, 2019
152976f
Try to fix dtslint issues
joshburgess Feb 19, 2019
5745c3e
Move dtslint back to devDependencies
joshburgess Feb 19, 2019
09f0c94
Try to fix dtslint yet again
joshburgess Feb 19, 2019
2657989
dtslint...
joshburgess Feb 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
441 changes: 441 additions & 0 deletions docs/Map.md

Large diffs are not rendered by default.

48 changes: 30 additions & 18 deletions docs/Monoid.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Module Monoid

# Monoid

**Signature** (type class) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L26-L28)
**Signature** (type class) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L27-L29)

```ts
export interface Monoid<A> extends Semigroup<A> {
Expand All @@ -23,7 +23,7 @@ Added in v1.0.0

Boolean monoid under conjunction

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L61-L64)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L62-L65)

```ts
export const monoidAll: Monoid<boolean> = ...
Expand All @@ -35,7 +35,7 @@ Added in v1.0.0

Boolean monoid under disjunction

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L70-L73)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L71-L74)

```ts
export const monoidAny: Monoid<boolean> = ...
Expand All @@ -47,7 +47,7 @@ Added in v1.0.0

Number monoid under multiplication

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L130-L133)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L143-L146)

```ts
export const monoidProduct: Monoid<number> = ...
Expand All @@ -57,7 +57,7 @@ Added in v1.0.0

## monoidString

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L138-L141)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L151-L154)

```ts
export const monoidString: Monoid<string> = ...
Expand All @@ -69,7 +69,7 @@ Added in v1.0.0

Number monoid under addition

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L121-L124)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L134-L137)

```ts
export const monoidSum: Monoid<number> = ...
Expand All @@ -79,7 +79,7 @@ Added in v1.0.0

## monoidVoid

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L146-L149)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L159-L162)

```ts
export const monoidVoid: Monoid<void> = ...
Expand All @@ -89,7 +89,7 @@ Added in v1.0.0

## unsafeMonoidArray

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L80-L83)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L81-L84)

```ts
export const unsafeMonoidArray: Monoid<Array<any>> = ...
Expand All @@ -99,7 +99,7 @@ Added in v1.0.0

## fold

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L33-L35)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L34-L36)

```ts
export const fold = <A>(M: Monoid<A>): ((as: Array<A>) => A) => { ... }
Expand All @@ -111,7 +111,7 @@ Added in v1.0.0

Monoid under array concatenation (`Array<any>`)

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L90-L92)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L91-L93)

```ts
export const getArrayMonoid = <A = never>(): Monoid<Array<A>> => { ... }
Expand All @@ -123,7 +123,7 @@ Added in v1.0.0

Gets [Monoid](./Monoid.md) instance for dictionaries given [Semigroup](./Semigroup.md) instance for their values

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L110-L115)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L111-L116)

```ts
export function getDictionaryMonoid<A>(S: Semigroup<A>): Monoid< { ... }
Expand All @@ -143,7 +143,7 @@ Added in v1.4.0

## getDualMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L50-L55)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L51-L56)

```ts
export const getDualMonoid = <A>(M: Monoid<A>): Monoid<A> => { ... }
Expand All @@ -153,7 +153,7 @@ Added in v1.0.0

## getEndomorphismMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L164-L169)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L177-L182)

```ts
export const getEndomorphismMonoid = <A = never>(): Monoid<Endomorphism<A>> => { ... }
Expand All @@ -163,7 +163,7 @@ Added in v1.0.0

## getFunctionMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L154-L159)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L167-L172)

```ts
export const getFunctionMonoid = <M>(M: Monoid<M>) => <A = never>(): Monoid<(a: A) => M> => { ... }
Expand All @@ -173,17 +173,29 @@ Added in v1.0.0

## getJoinMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L201-L206)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L214-L219)

```ts
export const getJoinMonoid = <A>(B: Bounded<A>): Monoid<A> => { ... }
```

Added in v1.9.0

## getMapMonoid

Gets [Monoid](./Monoid.md) instance for Maps given [Semigroup](./Semigroup.md) instance for their values

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L123-L128)

```ts
export const getMapMonoid = <K, A>(S: Semigroup<A>): Monoid<Map<K, A>> => { ... }
```

Added in v1.14.0

## getMeetMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L191-L196)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L204-L209)

```ts
export const getMeetMonoid = <A>(B: Bounded<A>): Monoid<A> => { ... }
Expand All @@ -193,7 +205,7 @@ Added in v1.9.0

## getProductMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L40-L45)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L41-L46)

```ts
export const getProductMonoid = <A, B>(MA: Monoid<A>, MB: Monoid<B>): Monoid<[A, B]> => { ... }
Expand All @@ -203,7 +215,7 @@ Added in v1.0.0

## getRecordMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L174-L186)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L187-L199)

```ts
export const getRecordMonoid = <O extends { [key: string]: any }>(
Expand Down
22 changes: 17 additions & 5 deletions docs/Semigroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Added in v1.0.0

Number Semigroup under multiplication

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L182-L184)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L202-L204)

```ts
export const semigroupProduct: Semigroup<number> = ...
Expand All @@ -57,7 +57,7 @@ Added in v1.0.0

## semigroupString

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L189-L191)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L209-L211)

```ts
export const semigroupString: Semigroup<string> = ...
Expand All @@ -69,7 +69,7 @@ Added in v1.0.0

Number Semigroup under addition

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L174-L176)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L194-L196)

```ts
export const semigroupSum: Semigroup<number> = ...
Expand All @@ -79,7 +79,7 @@ Added in v1.0.0

## semigroupVoid

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L196-L198)
**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L216-L218)

```ts
export const semigroupVoid: Semigroup<void> = ...
Expand Down Expand Up @@ -180,6 +180,18 @@ export const getLastSemigroup = <A = never>(): Semigroup<A> => { ... }

Added in v1.0.0

## getMapSemigroup

Gets [Semigroup](./Semigroup.md) instance for Maps given [Semigroup](./Semigroup.md) instance for their values

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L157-L170)

```ts
export const getMapSemigroup = <K, A>(S: Semigroup<A>): Semigroup<Map<K, A>> => { ... }
```

Added in v1.14.0

## getMeetSemigroup

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L81-L85)
Expand All @@ -194,7 +206,7 @@ Added in v1.0.0

Gets [Semigroup](./Semigroup.md) instance for objects of given type preserving their type

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L166-L168)
**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Semigroup.ts#L186-L188)

```ts
export const getObjectSemigroup = <A extends object = never>(): Semigroup<A> => { ... }
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- [IxMonad](./IxMonad.md)
- [JoinSemilattice](./JoinSemilattice.md)
- [Lattice](./Lattice.md)
- [Map](./Map.md)
- [MeetSemilattice](./MeetSemilattice.md)
- [Monad](./Monad.md)
- [MonadIO](./MonadIO.md)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"typings": "lib/index.d.ts",
"scripts": {
"lint": "tslint -p tsconfig.tslint.json src/**/*.ts test/**/*.ts",
"jest": "jest --ci",
"jest-coverage": "jest --ci --coverage",
"jest": "jest --testURL=\"http://localhost\" --ci",
"jest-coverage": "jest --testURL=\"http://localhost\" --ci --coverage",
"prettier": "prettier --list-different \"./{src,test,examples,exercises}/**/*.ts\"",
"fix-prettier": "prettier --write \"./{src,test,examples,exercises}/**/*.ts\"",
"test": "npm run lint && npm run prettier && npm run dtslint && npm run jest && npm run docs",
Expand Down
Loading