Skip to content

Commit

Permalink
upgrade to latest fp-ts (0.4.3) (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Jul 28, 2017
1 parent 03f6e5f commit ece5950
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
**Note**: Gaps between patch versions are faulty/broken releases.
**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice.

# 0.3.2

- **Polish**
- upgrade to latest fp-ts (0.4.3) (@gcanti)

# 0.3.1

- **New Feature**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monocle-ts",
"version": "0.3.1",
"version": "0.3.2",
"description": "A porting of scala monocle library to TypeScript",
"files": ["lib"],
"main": "lib/index.js",
Expand All @@ -26,7 +26,7 @@
},
"homepage": "https://github.com/gcanti/monocle-ts",
"dependencies": {
"fp-ts": "^0.4.0"
"fp-ts": "^0.4.3"
},
"devDependencies": {
"@types/mocha": "^2.2.38",
Expand Down
12 changes: 0 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,15 +675,3 @@ export class Ops {
const ops = new Ops()
export const fromTraversable: Ops['fromTraversable'] = ops.fromTraversable
export const fromFoldable: Ops['fromFoldable'] = ops.fromFoldable

//
// overloadings
//

import { ArrayURI } from 'fp-ts/lib/overloadings'

export interface Ops {
fromTraversable<A>(T: Traversable<ArrayURI>): Traversal<Array<A>, A>

fromFoldable<A>(F: Foldable<ArrayURI>): Fold<Array<A>, A>
}
5 changes: 5 additions & 0 deletions test/Iso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Iso } from '../src'
import * as assert from 'assert'

const mTokm = new Iso<number, number>(m => m / 1000, km => km * 1000)
const kmToMile = new Iso<number, number>(km => km * 0.621371, mile => mile / 0.621371)

describe('Iso', () => {
it('get', () => {
Expand All @@ -16,4 +17,8 @@ describe('Iso', () => {
const double = (x: number) => x * 2
assert.strictEqual(mTokm.modify(double, 1000), 2000)
})

it('compose', () => {
assert.strictEqual(mTokm.compose(kmToMile).get(1500).toFixed(2), '0.93')
})
})

0 comments on commit ece5950

Please sign in to comment.