-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* roadmap * Update BASIC_TYPES.md * New documentation files
- Loading branch information
Showing
7 changed files
with
175 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Flags | ||
|
||
Elchemy compiler for purposes of experimenting and stretching the boundaries accepts flags. | ||
|
||
#### DO NOT ATTEMPT TO DO THAT UNLESS YOU'RE SURE IT'S THE ONLY WAY | ||
|
||
To pass a flag to a compiler there is a special comment syntax | ||
|
||
``` | ||
{- flag flagname:+argument flagname2:+argument2 } | ||
``` | ||
|
||
So far there is 4 flag types: | ||
#### `notype:+TypeName` | ||
Omits putting the `@type` into the compiled output code | ||
Used when you need type checking inside Elchemy ecosystem, without forwarding the definition into the output code. | ||
Example: | ||
```elm | ||
{- flag notype:+MyHiddenType -} | ||
type MyHiddenType = Hidden a | ||
``` | ||
--- | ||
#### `nodef:+functionName` | ||
Omits entire function definition from the code output. The function `@spec` will still be produced. | ||
Example: | ||
```elm | ||
{- flag nodef:+myHiddenFunction -} | ||
myHiddenFunction = 1 | ||
``` | ||
--- | ||
#### `nospec:+functionName` | ||
Omits function spec from the code output | ||
Example: | ||
```elm | ||
{- flag nospec:+myHiddenFunction -} | ||
myHiddenFunction : Int | ||
``` | ||
--- | ||
#### `noverify:+functionName` | ||
Omits function verify macro from the code output. Usable only when using for functions defined as FFI | ||
Example: | ||
```elm | ||
{- flag nospec:+myHiddenFunction -} | ||
myHiddenFunction : Int | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Inlining Elixir Code | ||
|
||
|
||
#### DO NOT ATTEMPT TO DO THAT UNLESS YOU'RE SURE IT'S THE ONLY WAY | ||
|
||
In Elchemy it's possible to inline Elixir code using | ||
|
||
```elm | ||
{- ex | ||
## Code | ||
def any_function() do | ||
1 | ||
end | ||
-} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Installation | ||
|
||
You can install Elchemy using [npm](https://www.npmjs.com/) with | ||
``` | ||
npm install -g elchemy | ||
``` | ||
|
||
To integrate Elchemy with your project you need to execute: | ||
|
||
``` | ||
elchemy init | ||
``` | ||
|
||
Inside your elixir project directory. | ||
If you don't have a project created, you need to first create it. It's advised to use [Mix](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html#our-first-project) for that. | ||
|
||
Assuming the simplest example project called `my_project` the standard path would be: | ||
|
||
``` | ||
mix new my_project | ||
cd my_project | ||
elchemy init | ||
``` | ||
|
||
Then open your `mix.exs` file inside project root directory. And add | ||
```elixir | ||
|> Code.eval_file("elchemy.exs").init | ||
``` | ||
At the end of your `project/0` function definition. Like so: | ||
Before: | ||
```elixir | ||
defmodule MyProject.Mixfile do | ||
use Mix.Project | ||
|
||
def project do | ||
[ | ||
app: :my_project, | ||
version: "0.1.0", | ||
elixir: "~> 1.5", | ||
start_permanent: Mix.env == :prod, | ||
deps: deps() | ||
] | ||
end | ||
|
||
# Run "mix help compile.app" to learn about applications. | ||
def application do | ||
... | ||
``` | ||
After: | ||
```elixir | ||
defmodule MyProject.Mixfile do | ||
use Mix.Project | ||
|
||
def project do | ||
[ | ||
app: :my_project, | ||
version: "0.1.0", | ||
elixir: "~> 1.5", | ||
start_permanent: Mix.env == :prod, | ||
deps: deps() | ||
] |> Code.eval_file("elchemy.exs").init | ||
end | ||
|
||
# Run "mix help compile.app" to learn about applications. | ||
def application do | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Side Effects | ||
|
||
It's currently impossible to express side effects using Elchemy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Testing | ||
|
||
So far there is no unit testing tool for Elchemy. | ||
To test your code use Elixir's `ExUnit` or see document [COMMENTS.md](COMMENTS.md) for using Doctests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Troubleshooting | ||
|
||
Generally grand amount of problems can be solved with a simple command: | ||
``` | ||
elchemy clean | ||
``` | ||
|
||
It cleans all of the caches, temporary files, dependencies and code file outputs out of the current project. | ||
|
||
If | ||
``` | ||
elchemy clean | ||
elchemy init | ||
mix compile | ||
``` | ||
|
||
still yields compilation errors feel free to report an issue. | ||
For the sake of being able to reproduce please provide: | ||
|
||
- Elchemy version (`elchemy version`) | ||
- Elixir version (`elixir -v`) | ||
- Erlang version (first line in `erl`) | ||
- Elm version (`elm -v`) | ||
- Operating system (`uname -msr`) | ||
|
||
It's also helpful to include: | ||
- Result of `tree -L 2` inside your project folder | ||
- Code of the file failing |