Skip to content

Commit

Permalink
Release 8.0.0
Browse files Browse the repository at this point in the history
This release updates sanctuary-type-classes, which contains a
breaking change. This change will only affect you if you are
using `Future.map` on other Functors, specifically, Objects.

!! Breaking changes !!

- When mapping over Object members using `Future.map`, inherited
  properties are no longer transformed.
  • Loading branch information
Avaq committed Dec 30, 2017
1 parent 332fb85 commit 0006beb
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 70 deletions.
153 changes: 84 additions & 69 deletions dist/bundle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Fluture bundled; version 7.2.2
* Fluture bundled; version 8.0.0
*/

var Fluture = (function () {
Expand Down Expand Up @@ -120,17 +120,12 @@ var sanctuaryTypeIdentifiers = createCommonjsModule(function (module) {

(function(f) {

'use strict';

{
module.exports = f();
}

}(function() {

'use strict';

// $$type :: String
var $$type = '@@type';

// type :: Any -> String
Expand Down Expand Up @@ -181,56 +176,52 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
//.
//. ## Type-class hierarchy
//.
/* eslint-disable max-len */
//. <pre>
//: Setoid Semigroupoid Semigroup Foldable Functor Contravariant
//: (equals) (compose) (concat) (reduce) (map) (contramap)
//: | | | \ / | | | | \
//: | | | \ / | | | | \
//: | | | \ / | | | | \
//: | | | \ / | | | | \
//: | | | \ / | | | | \
//: Ord Category Monoid Traversable | | | | \
//: (lte) (id) (empty) (traverse) / | | \ \
//: / | | \ \
//: / / \ \ \
//: Profunctor / \ Bifunctor \
//: (promap) / \ (bimap) \
//: / \ \
//: / \ \
//: Alt Apply Extend
//: (alt) (ap) (extend)
//: / / \ \
//: / / \ \
//: / / \ \
//: / / \ \
//: / / \ \
//: Plus Applicative Chain Comonad
//: (zero) (of) (chain) (extract)
//: \ / \ / \
//: \ / \ / \
//: \ / \ / \
//: \ / \ / \
//: \ / \ / \
//: Alternative Monad ChainRec
//: (chainRec)
//. Setoid Semigroupoid Semigroup Foldable Functor Contravariant
//. (equals) (compose) (concat) (reduce) (map) (contramap)
//. | | | \ / | | | | \
//. | | | \ / | | | | \
//. | | | \ / | | | | \
//. | | | \ / | | | | \
//. | | | \ / | | | | \
//. Ord Category Monoid Traversable | | | | \
//. (lte) (id) (empty) (traverse) / | | \ \
//. | / | | \ \
//. | / / \ \ \
//. | Profunctor / \ Bifunctor \
//. | (promap) / \ (bimap) \
//. | / \ \
//. Group / \ \
//. (invert) Alt Apply Extend
//. (alt) (ap) (extend)
//. / / \ \
//. / / \ \
//. / / \ \
//. / / \ \
//. / / \ \
//. Plus Applicative Chain Comonad
//. (zero) (of) (chain) (extract)
//. \ / \ / \
//. \ / \ / \
//. \ / \ / \
//. \ / \ / \
//. \ / \ / \
//. Alternative Monad ChainRec
//. (chainRec)
//. </pre>
/* eslint-enable max-len */
//.
//. ## API

(function(f) {

'use strict';

/* istanbul ignore else */
{
module.exports = f(sanctuaryTypeIdentifiers);
}

}(function(type) {

'use strict';

// concat_ :: Array a -> Array a -> Array a
function concat_(xs) {
return function(ys) {
return xs.concat(ys);
Expand All @@ -244,6 +235,11 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
};
}

// forEachKey :: (StrMap a, StrMap a ~> String -> Undefined) -> Undefined
function forEachKey(strMap, f) {
Object.keys(strMap).forEach(f, strMap);
}

// has :: (String, Object) -> Boolean
function has(k, o) {
return Object.prototype.hasOwnProperty.call(o, k);
Expand Down Expand Up @@ -361,7 +357,7 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
}

// functionName :: Function -> String
var functionName = 'name' in function f() {} ?
var functionName = has('name', function f() {}) ?
function functionName(f) { return f.name; } :
/* istanbul ignore next */
function functionName(f) {
Expand Down Expand Up @@ -391,7 +387,7 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
};
}

var version = '6.1.0'; // updated programmatically
var version = '7.1.1'; // updated programmatically
var keys = Object.keys(requirements);

var typeClass = TypeClass(
Expand Down Expand Up @@ -490,6 +486,19 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
//. ```
var Monoid = $('Monoid', [Semigroup], {empty: Constructor});

//# Group :: TypeClass
//.
//. `TypeClass` value for [Group][].
//.
//. ```javascript
//. > Group.test(Sum(0))
//. true
//.
//. > Group.test('')
//. false
//. ```
var Group = $('Group', [Monoid], {invert: Value});

//# Functor :: TypeClass
//.
//. `TypeClass` value for [Functor][].
Expand Down Expand Up @@ -1020,22 +1029,25 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
// Object$prototype$concat :: StrMap a ~> StrMap a -> StrMap a
function Object$prototype$concat(other) {
var result = {};
for (var k in this) result[k] = this[k];
for (k in other) result[k] = other[k];
function assign(k) { result[k] = this[k]; }
forEachKey(this, assign);
forEachKey(other, assign);
return result;
}

// Object$prototype$map :: StrMap a ~> (a -> b) -> StrMap b
function Object$prototype$map(f) {
var result = {};
for (var k in this) result[k] = f(this[k]);
forEachKey(this, function(k) { result[k] = f(this[k]); });
return result;
}

// Object$prototype$ap :: StrMap a ~> StrMap (a -> b) -> StrMap b
function Object$prototype$ap(other) {
var result = {};
for (var k in this) if (k in other) result[k] = other[k](this[k]);
forEachKey(this, function(k) {
if (has(k, other)) result[k] = other[k](this[k]);
});
return result;
}

Expand All @@ -1053,7 +1065,12 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
function Object$prototype$traverse(typeRep, f) {
var self = this;
return Object.keys(this).reduce(function(applicative, k) {
function set(o) { return function(v) { o[k] = v; return o; }; }
function set(o) {
return function(v) {
var singleton = {}; singleton[k] = v;
return Object$prototype$concat.call(o, singleton);
};
}
return lift2(set, applicative, f(self[k]));
}, of(typeRep, {}));
}
Expand Down Expand Up @@ -1574,6 +1591,18 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
return Monoid.methods.empty(typeRep)();
}

//# invert :: Group g => g -> g
//.
//. Function wrapper for [`fantasy-land/invert`][].
//.
//. ```javascript
//. invert(Sum(5))
//. Sum(-5)
//. ```
function invert(group) {
return Group.methods.invert(group)();
}

//# map :: Functor f => (a -> b, f a) -> f b
//.
//. Function wrapper for [`fantasy-land/map`][].
Expand Down Expand Up @@ -2267,6 +2296,7 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
Category: Category,
Semigroup: Semigroup,
Monoid: Monoid,
Group: Group,
Functor: Functor,
Bifunctor: Bifunctor,
Profunctor: Profunctor,
Expand Down Expand Up @@ -2295,6 +2325,7 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
id: id,
concat: concat,
empty: empty,
invert: invert,
map: map,
bimap: bimap,
promap: promap,
Expand Down Expand Up @@ -2344,6 +2375,7 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
//. [FL]: https://github.com/fantasyland/fantasy-land
//. [Foldable]: https://github.com/fantasyland/fantasy-land#foldable
//. [Functor]: https://github.com/fantasyland/fantasy-land#functor
//. [Group]: https://github.com/fantasyland/fantasy-land#group
//. [Monad]: https://github.com/fantasyland/fantasy-land#monad
//. [Monoid]: https://github.com/fantasyland/fantasy-land#monoid
//. [Ord]: https://github.com/fantasyland/fantasy-land#ord
Expand All @@ -2366,6 +2398,7 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
//. [`fantasy-land/extend`]: https://github.com/fantasyland/fantasy-land#extend-method
//. [`fantasy-land/extract`]: https://github.com/fantasyland/fantasy-land#extract-method
//. [`fantasy-land/id`]: https://github.com/fantasyland/fantasy-land#id-method
//. [`fantasy-land/invert`]: https://github.com/fantasyland/fantasy-land#invert-method
//. [`fantasy-land/lte`]: https://github.com/fantasyland/fantasy-land#lte-method
//. [`fantasy-land/map`]: https://github.com/fantasyland/fantasy-land#map-method
//. [`fantasy-land/of`]: https://github.com/fantasyland/fantasy-land#of-method
Expand All @@ -2380,17 +2413,12 @@ var sanctuaryTypeClasses = createCommonjsModule(function (module) {
var inspectF = createCommonjsModule(function (module) {
(function(global, f) {

'use strict';

/*istanbul ignore next*/
{
module.exports = f();
}

}(/*istanbul ignore next*/(commonjsGlobal || window || commonjsGlobal), function() {

'use strict';

function checkn(n) {
if(typeof n !== 'number') {
throw new TypeError(
Expand Down Expand Up @@ -2617,17 +2645,12 @@ var sanctuaryTypeIdentifiers$2 = createCommonjsModule(function (module) {

(function(f) {

'use strict';

{
module.exports = f();
}

}(function() {

'use strict';

// $$type :: String
var $$type = '@@type';

// pattern :: RegExp
Expand Down Expand Up @@ -2776,9 +2799,6 @@ function invalidFuture(it, at, m, s){
var concurrify = createCommonjsModule(function (module) {
(function(global, f){

'use strict';

/*istanbul ignore next*/
if(module && 'object' !== 'undefined'){
module.exports = f(sanctuaryTypeClasses, sanctuaryTypeIdentifiers$2);
}else{
Expand All @@ -2787,15 +2807,12 @@ var concurrify = createCommonjsModule(function (module) {

}(/*istanbul ignore next*/(commonjsGlobal || window || commonjsGlobal), function(Z, type){

'use strict';

var $alt = 'fantasy-land/alt';
var $ap = 'fantasy-land/ap';
var $map = 'fantasy-land/map';
var $of = 'fantasy-land/of';
var $zero = 'fantasy-land/zero';
var $$type = '@@type';

var ordinal = ['first', 'second', 'third', 'fourth', 'fifth'];

function isFunction(f){
Expand Down Expand Up @@ -2850,7 +2867,6 @@ var concurrify = createCommonjsModule(function (module) {

var INNERTYPE = getTypeIdentifier(Repr);
var OUTERTYPE = generateTypeIdentifier(INNERTYPE);

var INNERNAME = type.parse(INNERTYPE).name;
var OUTERNAME = type.parse(OUTERTYPE).name;

Expand Down Expand Up @@ -2887,6 +2903,7 @@ var concurrify = createCommonjsModule(function (module) {
construct[$$type] = OUTERTYPE;

var mzero = new Concurrently(zero);

construct[$zero] = function Concurrently$zero(){
return mzero;
};
Expand Down Expand Up @@ -2957,8 +2974,6 @@ function isArray(x){
return Array.isArray(x);
}

'use strict';

/**
* Custom implementation of a double ended queue.
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fluture",
"version": "7.2.2",
"version": "8.0.0",
"description": "FantasyLand compliant (monadic) alternative to Promises",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 0006beb

Please sign in to comment.