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

Using numbers in template #5

Closed
rkosafo opened this issue May 27, 2017 · 3 comments
Closed

Using numbers in template #5

rkosafo opened this issue May 27, 2017 · 3 comments

Comments

@rkosafo
Copy link

rkosafo commented May 27, 2017

Given

""" {{{multiply 2}}}"""
""" {{{multiply n}}}"""

And

init
|> add "n" 10
|> add "multiply" (fun x -> x * 2)

The first one with the literal 2 fails to compile.
The second works.

How does on specify numbers in the template?

@Dzoukr
Copy link
Owner

Dzoukr commented May 27, 2017

Thanks for report. To fix this, I need to actually forbid adding values into map starting with number (to use numbers as number and not string keys, which would be breaking change. However I do not think anybody actually do this.

For now, to workaround this, you can change your first function:

""" {{{multiply '2'}}}"""

and change your multiply function to

(fun x -> (int x) * 2)

Meanwhile, I`ll try to fix it.

@rkosafo
Copy link
Author

rkosafo commented May 27, 2017

For some reason """ {{{multiply '2'}}}"" does not call the multiply function. For it to work, multiply must specify the type explicitly as in add "multiply" (fun (x: string) -> (int x) * 2)

Dzoukr added a commit that referenced this issue May 29, 2017
Supports using numbers in templates (Issue #5)
Improved parsing logic
@Dzoukr
Copy link
Owner

Dzoukr commented May 29, 2017

Fixed in v1.3.0

@Dzoukr Dzoukr closed this as completed May 29, 2017
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

2 participants