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

Consider changing EngineEvalArg to be an HMap, HList, etc. #16

Open
bbarker opened this issue Jun 2, 2020 · 1 comment
Open

Consider changing EngineEvalArg to be an HMap, HList, etc. #16

bbarker opened this issue Jun 2, 2020 · 1 comment
Labels

Comments

@bbarker
Copy link
Collaborator

bbarker commented Jun 2, 2020

The idea is that when writing FFI calls to the Engine, one often ends up calling anyMXArray for most arguments in the argument list to get the type to agree (i.e., everything becomes MAny). Not only is this slightly tedious, but having to maintain these rather-untyped argument lists all over the place seems a bit dangerous. It might be better to have that machinery all in one place: Engine.hsc in this package, rather than user-code.

Of course, as I recall, using HList can also be tedious (at least in Scala - I don't think I've used any of these datatypes in Haskell so far (that I recall), so take this with a grain of salt). And what this suggests is that we'd be leaking HList into the user API.

Why an HMap? It isn't good for ordered arguments, but could replace what is currently being used for VarArgIn (a regular Data.Map).

Maybe use a record to combine these ideas; some pseudo-code:

data EvalArgs = EvalArgs {args:: HList, varargin:: HMap}
@bbarker
Copy link
Collaborator Author

bbarker commented Jun 5, 2020

A few suggestions on HList-like options to look into:

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

No branches or pull requests

1 participant