thefrontside/microstates

Remove `parameterized` functionality and replace with simple functions

cowboyd opened this issue · 0 comments

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 with ObjectOf() function
  • replace ArrayType with ArrayOf() function
  • make new functions stable such that ArrayOf(Type) === ArrayOf(Type)
  • remove parameterized.js