Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Type constructors in env with actual Types #354

Merged
merged 1 commit into from
Feb 26, 2017

Conversation

Avaq
Copy link
Member

@Avaq Avaq commented Feb 24, 2017

Based on sanctuary-js/sanctuary-def#123

This fixes the inconsistent type of env, allowing it to be passed into $.test. We should release this as a patch.

@Avaq Avaq requested a review from davidchambers February 24, 2017 09:24
test/env.js Outdated
var eq = require('./internal/eq');


var $Type = $.NullaryType(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if sanctuary-def exports Type, so I don't have to create it myself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we name this Type rather than $Type? Regardless, let's add a type signature. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Avaq
Copy link
Member Author

Avaq commented Feb 24, 2017

If sanctuary-def exports Type, we would also be able to use it in the definition of Options. For now I don't think we should go for that, as it may be considered "breaking".

@davidchambers
Copy link
Member

Could you update this pull request's destination branch to the temporary 0.12.x branch I just created?

test/env.js Outdated
var $ = require('sanctuary-def');
var type = require('sanctuary-type-identifiers');

var eq = require('./internal/eq');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's group the imports like so:

var $ = require('sanctuary-def');
var type = require('sanctuary-type-identifiers');

var S = require('..');

var eq = require('./internal/eq');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test/env.js Outdated
test('env', function() {

eq(typeof S.env, 'object');
eq($.test([], $.Array($Type), S.env), true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an elegant assertion!

test/env.js Outdated
var $Type = $.NullaryType(
'sanctuary/Type',
'',
function(x) { return type(x) === 'sanctuary-def/Type'; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider using S.type here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Avaq Avaq changed the base branch from master to 0.12.x February 26, 2017 12:01
@davidchambers davidchambers merged commit 37adc31 into 0.12.x Feb 26, 2017
@davidchambers davidchambers deleted the avaq/fix-env branch February 26, 2017 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants