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

use ES modules #325

Merged
merged 1 commit into from
Dec 30, 2023
Merged

use ES modules #325

merged 1 commit into from
Dec 30, 2023

Conversation

davidchambers
Copy link
Member

@@ -81,6 +82,8 @@ def ('$26')
(a => b => c => d => e => f => g => h => i => j => k => l => m => n => o => p => q => r => s => t => u => v => w => x => y => z =>
[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]);

const suite = (_, run) => run ();
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a small hack to keep the tests running with minimal changes. I have noticed that this indirection makes the locations of test failures reported by Oletus less helpful; I am willing to tolerate this.

Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines -14 to +12
(fs);
($);
Copy link
Member Author

Choose a reason for hiding this comment

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

$ is now a Module object so can be used in place of fs.

Comment on lines +358 to +370
const UnaryTypeWithUrl = name => supertypes => test => _1 => (
def (name)
({})
([Type, Type])
(_UnaryType (name) (functionUrl (name)) (supertypes) (test) (_1))
);

const BinaryTypeWithUrl = name => supertypes => test => _1 => _2 => (
def (name)
({})
([Type, Type, Type])
(_BinaryType (name) (functionUrl (name)) (supertypes) (test) (_1) (_2))
);
Copy link
Member Author

Choose a reason for hiding this comment

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

These functions now do more than before: they use def in addition to functionUrl.

index.js Outdated
null,
[]
);
const env = [];
Copy link
Member Author

Choose a reason for hiding this comment

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

env is now defined here, provided to mkdef below, and populated later. 🙈

Comment on lines +394 to +400
//# Type :: Type
//.
//. Type comprising every `Type` value.
export const Type = NullaryTypeWithUrl
('Type')
([])
(x => type (x) === 'sanctuary-def/Type@1');
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved this block to the top of the section as other type definitions depend on Type.

Comment on lines +402 to +414
//# NonEmpty :: Type -> Type
//.
//. Constructor for non-empty types. `$.NonEmpty ($.String)`, for example, is
//. the type comprising every [`String`][] value except `''`.
//.
//. The given type must satisfy the [Monoid][] and [Setoid][] specifications.
export const NonEmpty = UnaryTypeWithUrl
('NonEmpty')
([])
(x => Z.Monoid.test (x) &&
Z.Setoid.test (x) &&
!(Z.equals (x, Z.empty (x.constructor))))
(monoid => [monoid]);
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved this block near the top of the section as other type definitions depend on NonEmpty.

Comment on lines -2679 to -2689
// fromUncheckedUnaryType :: (Type -> Type) -> Type -> Type
const fromUncheckedUnaryType = typeConstructor => {
const t = typeConstructor (Unknown);
return def (t.name) ({}) ([Type, Type]) (fromUnaryType (t));
};

// fromUncheckedBinaryType :: (Type -> Type -> Type) -> Type -> Type -> Type
const fromUncheckedBinaryType = typeConstructor => {
const t = typeConstructor (Unknown) (Unknown);
return def (t.name) ({}) ([Type, Type, Type]) (fromBinaryType (t));
};
Copy link
Member Author

Choose a reason for hiding this comment

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

These functions are no longer used.

// satisfactoryTypes :: ... -> Either (() -> Error)
// { typeVarMap :: TypeVarMap
// , types :: Array Type }
function satisfactoryTypes(
Copy link
Member Author

Choose a reason for hiding this comment

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

This function now needs to be hoisted. 🙈

index.js Outdated Show resolved Hide resolved
@davidchambers davidchambers merged commit 98ffbc4 into main Dec 30, 2023
3 checks passed
@davidchambers davidchambers deleted the davidchambers/esm branch December 30, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants