-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
use ES modules #325
Conversation
@@ -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 (); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also bearror/oletus#21
(fs); | ||
($); |
There was a problem hiding this comment.
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
.
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)) | ||
); |
There was a problem hiding this comment.
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 = []; |
There was a problem hiding this comment.
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. 🙈
//# Type :: Type | ||
//. | ||
//. Type comprising every `Type` value. | ||
export const Type = NullaryTypeWithUrl | ||
('Type') | ||
([]) | ||
(x => type (x) === 'sanctuary-def/Type@1'); |
There was a problem hiding this comment.
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
.
//# 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]); |
There was a problem hiding this comment.
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
.
// 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)); | ||
}; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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. 🙈
2ec6a02
to
a525eca
Compare
sanctuary-js/sanctuary#726