Remove `parameterized` functionality and replace with simple functions
cowboyd opened this issue · 0 comments
cowboyd commented
One of the patterns that has emerged with using microstates a lot is the concept of a "higher order" microstate: A function that takes a parameter and returns a microstate type. parameterized()
was a very rudimentary implementation of this, but is no longer necessary since it's now obvious in retrospect that we could have used simple functions instead.
The only parameterized types in the system are ObjectType
and ArrayType
, which should be replaced by functions: ObjectOf()
and ArrayOf()
:
before
let array = create(ArrayType.of(String), ['hi']);
after
let array = create(ArrayOf(String), ['hi']);
In actual fact however, this will be little noticed since most of the time we use the DSL anyhow.
but mostly still just
let array = create([String], ['hi']);
checklist:
- replace
ObjectType
withObjectOf()
function - replace
ArrayType
withArrayOf()
function - make new functions stable such that
ArrayOf(Type) === ArrayOf(Type)
- remove
parameterized.js