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

Add support for constructors #2

Open
paluh opened this issue Jul 30, 2022 · 1 comment
Open

Add support for constructors #2

paluh opened this issue Jul 30, 2022 · 1 comment

Comments

@paluh
Copy link
Member

paluh commented Jul 30, 2022

We want to support constructors from the PS level. Let's introduce set of types and helpers:

foreign import data EffectConstructorFn2 :: Type -> Type -> Type -> EffectConstructorConstructorFn2

foreign import data runEffectConstructorFn2 ::
  forall a b obj. EffectFn3 (EffectConstructorFn2 a b obj) a b obj

Runners should use a referenced function and call new on function application - I mean usual stuff:

export function runEffectConstructorFn2(f, arg1, arg2) {
  return (new f(arg1, arg2));
}
@paluh
Copy link
Member Author

paluh commented Jul 30, 2022

I left obj :: Type above - it gives us flexibility so when we are going process constructors in a generic way we can handle both JSObject and newtyped JSObject as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant