This repository was archived by the owner on Oct 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
begin to document all kernel function in elm/core #57
Open
harrysarson
wants to merge
5
commits into
elm-in-elm:master
Choose a base branch
from
harrysarson:kernel
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8cd54df
begin to document all kernel function in elm/core
harrysarson 1aebc78
Add bitwise functions
harrysarson 4c04bb7
begin to document platform module
harrysarson 1452220
remove prod/debug
harrysarson 8e017fb
add global mutable variables info
harrysarson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,62 @@ | ||
# Kernel functions in `elm/core` | ||
|
||
This documents lists all kernel functions defined in JavaScript files contained within `src/Elm/Kernel/`. | ||
Each row in the table corresponds to a function, each kernel module (a JavaScript file) will span multiple rows, one for each function defined in that module. | ||
|
||
These kernel functions are private to `elm/core` and thus they can only be called by other functions in `elm/core`. | ||
The last column of the table contains a best effort to exhustively list all the places that call each kernel function. | ||
|
||
# List of all kernel functions | ||
|
||
| Module | Function | Notes | Used by | | ||
| ------------------------- | ------------- | ------------- | ------------- | | ||
| `Elm.Kernel.Basics` | `add` | [1](###1) | `Basics.add` | | ||
| | `sub` | [1](###1) | `Basics.sub` | | ||
| | `mul` | [1](###1) | `Basics.mul` | | ||
| | `fdiv` | [1](###1) | `Basics.fdiv` | | ||
| | `idiv` | [1](###1) | `Basics.idiv` | | ||
| | `pow` | [1](###1) | `Basics.pow` | | ||
| | `pow` | todo... | | ||
| | `remainderBy` | todo... | | ||
| | `modBy` | todo... | | ||
| | `pi` | todo... | | ||
| | `e` | todo... | | ||
| | `cos` | todo... | | ||
| | `sin` | todo... | | ||
| | `tan` | todo... | | ||
| | `acos` | todo... | | ||
| | `asin` | todo... | | ||
| | `atan` | todo... | | ||
| | `atan2` | todo... | | ||
| | `toFloat` | todo... | | ||
| | `truncate` | todo... | | ||
| | `isInfinite` | todo... | | ||
| | `ceiling` | todo... | | ||
| | `floor` | todo... | | ||
| | `round` | todo... | | ||
| | `sqrt` | todo... | | ||
| | `log` | todo... | | ||
| | `isNaN` | todo... | | ||
| | `not` | todo... | | ||
| | `and` | todo... | | ||
| | `or` | todo... | | ||
| | `xor` | todo... | | ||
| `Elm.Kernel.Bitwise` | todo... | | ||
| `Elm.Kernel.Char` | todo... | | ||
| `Elm.Kernel.Debug` | todo... | | ||
| `Elm.Kernel.JsArray` | todo... | | ||
| `Elm.Kernel.List` | todo... | | ||
| `Elm.Kernel.Platform` | todo... | | ||
harrysarson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| `Elm.Kernel.Process` | todo... | | ||
| `Elm.Kernel.Scheduler` | todo... | | ||
| `Elm.Kernel.String` | todo... | | ||
| `Elm.Kernel.Utils` | todo... | | ||
|
||
## Notes | ||
|
||
### 1 | ||
|
||
For elm code like `x + y` or `time / 60`, the official compiler generates javascript using the operators directly. | ||
These functions will only be called if the user does `add x y` or `fdiv time 60`. | ||
I (Harry Sarson) belive that `Basics.add` calls `Elm.Kernel.Basics.add` entirely so that the type resolution part of the compiler can treat `(+)` as an operator defined by `infix left 6 (+) = add`. | ||
The code generation part of the compiler then special cases these operators. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.