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

Remove parameterized functionality and replace with simple functions #335

Open
4 tasks
cowboyd opened this issue Mar 19, 2019 · 0 comments
Open
4 tasks

Comments

@cowboyd
Copy link
Member

cowboyd commented Mar 19, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants