Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
babcb59
minimise kernel code required for Basics.elm
harrysarson Sep 16, 2019
91b2a24
test: fix test runner for elm 0.19.1
harrysarson Oct 25, 2019
f5d6024
avoid kernel code in Basics.elm
harrysarson Oct 25, 2019
dbf29e3
implement List.mapN without kernel code
harrysarson Oct 26, 2019
d7fef33
add more tests for List.mapN
harrysarson Oct 26, 2019
2627e4d
util: add custom-core script
harrysarson Nov 9, 2019
bdf62c1
add list map benchmarks
harrysarson Nov 12, 2019
886f0b6
add operator comutivity tests
harrysarson Nov 12, 2019
013b47f
update custom-core script
harrysarson Nov 12, 2019
f824427
remove old import from bitwise
harrysarson Nov 12, 2019
2af7d2d
Use an elm type for Cmd bags
harrysarson Nov 12, 2019
ed13487
fix errors in previous commit
harrysarson Nov 16, 2019
9316128
fix: add missing self case for Bag
harrysarson Nov 16, 2019
5eff30a
WIP
harrysarson Nov 17, 2019
a3dd48b
WIP: elm make works now
harrysarson Nov 24, 2019
95b30df
wip almost working
harrysarson Dec 7, 2019
6d6fa46
revert a lot of changes to try and compile
harrysarson Dec 7, 2019
b00e34e
time to readd kernel code
harrysarson Dec 8, 2019
a1c3e17
pulled in new kernel code
harrysarson Dec 8, 2019
f41180b
crash better
harrysarson Dec 9, 2019
d512db5
remove todo's from worker implementation
harrysarson Dec 9, 2019
5c899ea
fix some bugs in kernel code
harrysarson Dec 9, 2019
dd01f49
avoid triggering todo by wrapping in lambda
harrysarson Dec 9, 2019
7ba9d3c
fix more runtime bugs
harrysarson Dec 9, 2019
b94ef17
dispatch fixing
harrysarson Dec 9, 2019
5295341
rework elm/js devide for effect managers
harrysarson Dec 14, 2019
7947b8b
fix bugs with sending data to processes
harrysarson Dec 15, 2019
653da0e
getting there
harrysarson Dec 17, 2019
5ed86b6
entirely new scheduler
harrysarson Dec 17, 2019
55448ae
update scripts
harrysarson Dec 20, 2019
f80f14d
ctidying and misc improvements
harrysarson Dec 20, 2019
6e899f0
tests pass!
harrysarson Dec 20, 2019
c8c1d86
remove some uses of fudgeType
harrysarson Dec 20, 2019
992c1db
drop dead code and minimise number of fudges
harrysarson Dec 20, 2019
b799bd4
implement process functions
harrysarson Dec 20, 2019
195c9b2
tidy some more knarly bits of the runtime
harrysarson Dec 20, 2019
a6ca9f5
Merge branch 'master' into elm-in-elm
harrysarson Dec 21, 2019
89f2e5d
only copy the required files
harrysarson Dec 21, 2019
f5bf64f
rework initialize
harrysarson Dec 21, 2019
23ea65e
fix leaf for optimised builds
harrysarson Dec 21, 2019
5036951
fix type in last commit
harrysarson Dec 21, 2019
184804b
Copy elm/core's enqueuing of effects.
harrysarson Dec 21, 2019
1881317
fix: return processId if scheduler already working
harrysarson Dec 21, 2019
bcb4e3b
fix process kill
harrysarson Dec 21, 2019
430b611
newline after error message
harrysarson Dec 22, 2019
0d4f118
misc fixes:
harrysarson Dec 22, 2019
6b5dd3e
use promises (again) for next tick
harrysarson Dec 22, 2019
0c1ba20
do not pass sendToApp to setupOutgoingPort
harrysarson Dec 22, 2019
8733db9
tidy scheduler
harrysarson Dec 22, 2019
18d1449
complete docs for newProcessId
harrysarson Dec 22, 2019
d8ac74d
unexpose ctors of Cmd and Sub using kernel magic
harrysarson Dec 22, 2019
89f549d
move use of ProcessId ctor into Scheduler
harrysarson Dec 22, 2019
0d67065
ensure processId is always an object
harrysarson Dec 22, 2019
fcc3444
remove old file
harrysarson Dec 22, 2019
dc75131
fix unwrapTypeWrapper in optimize mode
harrysarson Dec 22, 2019
c3ae49e
stop exposing runtime details from `Platform`
harrysarson Dec 22, 2019
9fdaca6
update readme
harrysarson Dec 22, 2019
941e53b
run elm format
harrysarson Dec 22, 2019
c8d1a96
explicit exports from new elm files
harrysarson Dec 22, 2019
f81ce3f
explain RawScheduler
harrysarson Dec 22, 2019
ee3e842
access getGuid via elm redefinition
harrysarson Dec 22, 2019
a6ae569
correct type of incomingPort MySub msgs
harrysarson Dec 22, 2019
8562f43
misc code tidying
harrysarson Dec 22, 2019
5f880d0
use modern js in basics.js
harrysarson Jan 2, 2020
e319909
define List in elm and minimise kernel code
harrysarson Jan 2, 2020
ef7293b
tidy utils.js
harrysarson Jan 3, 2020
45857e9
simply scheduler by removing ProcessRoot type
harrysarson Jan 3, 2020
ace6b42
tidy runtime
harrysarson Jan 3, 2020
01b48b0
stop running each test twice
harrysarson Jan 8, 2020
e0a1622
Add workflows to set expectations about issues and pull requests
supermario Feb 10, 2020
866792d
Merge pull request #1077 from supermario/master
evancz Feb 10, 2020
0b75365
fix missing scope declaration on variable
decioferreira Feb 14, 2020
1dc9574
Merge pull request #1078 from decioferreira/fix-result-variable-scope
evancz Feb 14, 2020
ccd61a7
stop shadowing a variable name in the outer scope
evancz Feb 14, 2020
6503eaf
stop reusing a variable for the pair produced by init
evancz Feb 14, 2020
84f3889
bump to 1.0.5 for synchronous event fix
evancz Feb 15, 2020
ae911cf
add newlines to get formatting right
evancz Feb 21, 2020
22eefd2
add newlines to get formatting right
evancz Feb 21, 2020
842f6bd
sketch for processes receiving values via channels
harrysarson Mar 16, 2020
770e8bd
a WIP attempt to use new Tasks in Platform
harrysarson Mar 17, 2020
cc8923c
Revert "a WIP attempt to use new Tasks in Platform"
harrysarson Mar 17, 2020
8a3be5b
Revert "sketch for processes receiving values via channels"
harrysarson Mar 17, 2020
ebe2707
WIP channel api
harrysarson Mar 17, 2020
1f9069a
Revert "WIP channel api"
harrysarson Mar 17, 2020
fb08498
remove next tick hack
harrysarson Mar 18, 2020
bce1733
remove sync action
harrysarson Mar 18, 2020
846dc4d
new channel api
harrysarson Mar 19, 2020
250acab
move defintion above usage in js
harrysarson Mar 19, 2020
240d54b
remove waker from wakers before waking
harrysarson Mar 21, 2020
8cde0b1
merge a couple of kernel functions
harrysarson Mar 21, 2020
d2f8762
consolidate process id creation and registration
harrysarson Mar 21, 2020
1b8fafe
move raw modules around
harrysarson Mar 21, 2020
81b8974
split channel in sender and receiver parts
harrysarson Mar 21, 2020
d05df29
rename managers -> selfSenders
harrysarson Mar 21, 2020
7616a3b
use a Map instead of an object
harrysarson Mar 21, 2020
0a0f59c
add channel map
harrysarson Mar 21, 2020
3ac7bc3
formatting
harrysarson Mar 22, 2020
935fd23
trial channel based effects with Task module
harrysarson Mar 22, 2020
b8162eb
tidy effect manager code
harrysarson Mar 22, 2020
9210ddb
tidy outgoing port js code
harrysarson Mar 22, 2020
0ad9832
implement outgoing ports using new effects
harrysarson Mar 24, 2020
65fcf67
use new effect mapCommand for outgoing ports
harrysarson Mar 24, 2020
8930c3e
remove dead code
harrysarson Mar 24, 2020
da43363
drop msg type param from processes
harrysarson Mar 26, 2020
120bb58
add Scheduler.batch and Channel.tryRecv
harrysarson Apr 2, 2020
441db6c
mega commit
harrysarson Apr 2, 2020
5f4dafe
use tasks instead of channels for commands
harrysarson Apr 2, 2020
d0bbf2c
format
harrysarson Apr 2, 2020
b911a70
add help information
harrysarson Apr 4, 2020
2b15d4d
fail fast on unknown runtime crash reason
harrysarson Apr 5, 2020
cbe5d64
fix crash in scheduler
harrysarson Apr 5, 2020
29abc4c
remove unused runtime crash reasons
harrysarson Apr 5, 2020
5cd7c53
use runtime elm code from js w/o passing it as arg
harrysarson Apr 5, 2020
4d91458
remove kernel function not calling elm code rule
harrysarson Apr 5, 2020
bab8e4c
tidy some Channel things
harrysarson Apr 12, 2020
e9dc910
definition lines can also contain kernel calls!
harrysarson Apr 12, 2020
9305022
tidy resetSubscription kernel api
harrysarson Apr 12, 2020
4fb74aa
tidy resetSubscriptions api (again) to use tasks
harrysarson Apr 12, 2020
ce53889
replace sync scheduler binding with execImpure
harrysarson Apr 12, 2020
0050091
avoid use of impure channel api in elm
harrysarson Apr 12, 2020
21af763
remove old incoming port manager
harrysarson Apr 12, 2020
6eaee18
make the ReceivedData custom type an impl. detail
harrysarson Apr 12, 2020
1e33f72
avoid impure channel creation
harrysarson Apr 12, 2020
340ae75
remove mapSender
harrysarson Apr 12, 2020
dd61908
remove non-raw channel api
harrysarson Apr 14, 2020
dca308b
use raw task in resetSubscriptions
harrysarson Apr 14, 2020
1994625
have dispatch effects return a raw task
harrysarson Apr 14, 2020
d0df42f
have setupEffects return a raw task
harrysarson Apr 14, 2020
9afb104
tidy setupEffectsChannel
harrysarson Apr 14, 2020
d114076
format
harrysarson Apr 14, 2020
fb3ef8b
update setupEffectsChannel docs
harrysarson Apr 14, 2020
cb01974
update docs
harrysarson Apr 14, 2020
3a1f989
prettier
harrysarson Apr 14, 2020
3009818
fix typo introduced whilst prettying
harrysarson Apr 14, 2020
1006dd7
create isDebug abstraction
harrysarson Apr 14, 2020
973b485
fix incorrect use of external kernel function
harrysarson Apr 14, 2020
62902b7
prettier check-kernel-imports
harrysarson Apr 14, 2020
7c5a39b
fix other kernel function calls with only one _
harrysarson Apr 14, 2020
a08c597
add array equality test
harrysarson Apr 14, 2020
8e474a4
remove unused imports
harrysarson Apr 14, 2020
6bed059
remove module Platform.Effects
harrysarson Apr 14, 2020
936ec68
prettier
harrysarson Apr 14, 2020
ed422d4
tidy tuple check
harrysarson Apr 14, 2020
fa10586
modernise js in Debug.js
harrysarson Apr 14, 2020
07b91b9
fix missing import
harrysarson Apr 15, 2020
b9fee3c
fix task commands
harrysarson Apr 15, 2020
7c1fd50
fix debug to string printing
harrysarson Apr 15, 2020
27334c6
remove messy wake logic from scheduler
harrysarson Apr 15, 2020
3f99f1e
do not register new processes
harrysarson Apr 15, 2020
1b0eede
fix incoming ports
harrysarson Apr 15, 2020
1a33464
remove support for effect managers!
harrysarson Apr 16, 2020
232e366
format
harrysarson Apr 16, 2020
0c0a46b
copy in files from elm/time
harrysarson Apr 19, 2020
926dac4
fix bug with kernel import
harrysarson Apr 19, 2020
f90617a
format
harrysarson Apr 19, 2020
d79bfdb
stub time
harrysarson Apr 25, 2020
e4456db
make time.every work
harrysarson Apr 25, 2020
597d47a
fix runAfterLoad
harrysarson Apr 25, 2020
745a560
tidy up Sub inner data types
harrysarson Apr 25, 2020
90b631b
wip impure functions
harrysarson Apr 26, 2020
8864a94
swap DoneCallback for Future
harrysarson Apr 26, 2020
e22bb10
add more checks in for kernel code validity
harrysarson Apr 26, 2020
1af9eef
add impure abstraction
harrysarson Apr 26, 2020
c089790
prettier test code
harrysarson Apr 26, 2020
7b1fda5
use the impure function abstraction in more places
harrysarson Apr 26, 2020
7dc5885
execImpure now takes impure functions as arguments
harrysarson Apr 26, 2020
353f326
use impure functions for sendToApp
harrysarson Apr 26, 2020
825c794
stub routers!
harrysarson Apr 26, 2020
0921996
remove a heap of dead code
harrysarson Apr 26, 2020
834b00f
fix stepperBuilder
harrysarson Apr 26, 2020
0a0201d
add Random module
harrysarson Apr 26, 2020
64110f4
format
harrysarson Apr 26, 2020
54fa35e
fix random
harrysarson Apr 26, 2020
d6a3f3d
Merge remote-tracking branch 'origin/master' into elm-in-elm
harrysarson Apr 26, 2020
04d77ec
fix tests
harrysarson Apr 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/set-issue-expectations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Set Issue Expectations
on:
issues:
types: [opened]
jobs:
comment-on-issue:
name: Comment On Issue
runs-on: ubuntu-latest
steps:
- uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: |
comment "Thanks for reporting this! To set expectations:

- Issues are reviewed in [batches](https://github.com/elm/expectations/blob/master/batching.md), so it can take some time to get a response.
- Ask questions a [community forum](https://elm-lang.org/community). You will get an answer quicker that way!
- If you experience something similar, open a new issue. [We like duplicates](https://github.com/elm/expectations/blob/master/duplicates.md).

Finally, please be patient with the core team. They are trying their best with limited resources."
21 changes: 21 additions & 0 deletions .github/workflows/set-pull-expectations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Set Pull Expectations
on:
pull_request:
types: [opened]
jobs:
comment-on-pull:
name: Comment On Pull
runs-on: ubuntu-latest
steps:
- uses: actions/github@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: |
comment "Thanks for suggesting these code changes. To set expectations:

- Pull requests are reviewed in [batches](https://github.com/elm/expectations/blob/master/batching.md), so it can take some time to get a response.
- Smaller pull requests are easier to review. To fix nine typos, nine specific issues will always go faster than one big one. Learn why [here](https://github.com/elm/expectations/blob/master/small-pull-requests.md).
- Reviewers may not know as much as you about certain situations, so add links to supporting evidence for important claims, especially regarding standards for CSS, HTTP, URI, etc.

Finally, please be patient with the core team. They are trying their best with limited resources."
51 changes: 51 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# NEWS

A little inline blog documenting the development of this library.

# 2020/4/26 -- Merge elm/random back into core

In my book, things that can manage effects belong in elm/core. This merge
required replacing effect manager code with an alternative (in this case
channel based) implementation.

The new implementation is not that nice. Maybe it will look better when I
manage to unifiy the two Task types. I think this is a case where the effect
manager abstraction really worked well. I might just have my rose tinted
specticles on.

# 2020/4/26 -- A new internal module `Platform.Raw.Impure`

This module contains an abstaction for functions that **do things** when
they are run. The functions in this module are constrained to take one argument
and return the unit tuple.

Why can we not use Task's for this, given that this is _exactly_ what they are
intended for. Well, two reasons

1. Sometimes we need a guarantee that the function will be run exactly when we
need to run. Task are always enqueued; they are only run after stepping
through all the previous Tasks in the queue. Sometimes, this is not
acceptable, for instance when updating the listeners for a subscription
effect.

2. We need to use impure functions to run Tasks. The
`Platform.Raw.Scheduler.enqueue` function takes a Task, adds it to the
scheduler queue and, if the scheduler is not currently stepping tasks (i.e.
this is not a reentrant call to `Platform.Raw.Scheduler.enqueue`), starts
stepping. This function is impure. However, if we represented it as a Task
we would have an infinite loop!

Hopefully, use of this module can be reduced to a couple of key places and
maybe even inlined into the scheduler is that is the only place that uses it.
Hopefully, it will help us move all effectful functions out of elm.


## 2020/04/26 - the future?

I wan't to move to away from callbacks and towards async/await and promises (or
futures). Firstly, I find that async/await is much easier to reason about than
callbacks and leads to much prettier code. Also, in the back of my mind is the
desire to eventually port the core libraries to rust for native compiled elm
code.

Todays change is just cosmetic, but hopefully is step 1.
34 changes: 9 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
# Core Libraries
# Elm-in-elm core libraries

Every Elm project needs this package!
> This repository currently contains a work in progress attempt to rewrite the elm core libraries into a form better suited for elm-in-elm.
> It has not yet been upstreamed or adopted by elm-in-elm; I hope one day to integrate this into elm-in-elm but currently is just my work.

It provides **basic functionality** like addition and subtraction as well as **data structures** like lists, dictionaries, and sets.
## Aims

> **New to Elm?** Go to [elm-lang.org](https://elm-lang.org) for an overview.
* Minimal amount of Kernel code.
* Easy to read.

## Rules

## Default Imports

The modules in this package are so common, that some of them are imported by default in all Elm files. So it is as if every Elm file starts with these imports:

```elm
import Basics exposing (..)
import List exposing (List, (::))
import Maybe exposing (Maybe(..))
import Result exposing (Result(..))
import String exposing (String)
import Char exposing (Char)
import Tuple

import Debug

import Platform exposing ( Program )
import Platform.Cmd as Cmd exposing ( Cmd )
import Platform.Sub as Sub exposing ( Sub )
```

The intention is to include things that are both extremely useful and very unlikely to overlap with anything that anyone will ever write in a library. By keeping the set of default imports relatively small, it also becomes easier to use whatever version of `map` suits your fancy. Finally, it makes it easier to figure out where the heck a function is coming from.
* Each kernel function may only be called via a type annotated redefinition in an elm file.
* Kernel functions may **not** call other kernel functions.
1 change: 1 addition & 0 deletions benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/elm-stuff/
29 changes: 29 additions & 0 deletions benchmark/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.1",
"elm/core": "1.0.2",
"elm/html": "1.0.0",
"elm-explorations/benchmark": "1.0.1"
},
"indirect": {
"BrianHicks/elm-trend": "2.1.3",
"Skinney/murmur3": "2.0.8",
"elm/json": "1.1.3",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2",
"mdgriffith/style-elements": "5.0.1"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
104 changes: 104 additions & 0 deletions benchmark/src/Main.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

module Main exposing (..)

import Benchmark.Runner exposing (BenchmarkProgram, program)

import Array
import Benchmark exposing (..)
import List exposing (reverse)


main : BenchmarkProgram
main =
program suite

cons : a -> List a -> List a
cons =
(::)


map2 : (a -> b -> result) -> List a -> List b -> List result
map2 f xs1 xs2 =
map5 (\a b _ _ _ -> f a b) xs1 xs2 xs1 xs1 xs1


{-|-}
map3 : (a -> b -> c -> result) -> List a -> List b -> List c -> List result
map3 f xs1 xs2 xs3 =
map5 (\a b c _ _ -> f a b c) xs1 xs2 xs3 xs1 xs1


{-|-}
map4 : (a -> b -> c -> d -> result) -> List a -> List b -> List c -> List d -> List result
map4 f xs1 xs2 xs3 xs4 =
map5 (\a b c d _ -> f a b c d) xs1 xs2 xs3 xs4 xs1



{-|-}
map5 : (a -> b -> c -> d -> e -> result) -> List a -> List b -> List c -> List d -> List e -> List result
map5 =
List.map5

map2Help : (a -> b -> result) -> List a -> List b -> List result -> List result
map2Help f xs1 xs2 ys =
case (xs1, xs2) of
(head1 :: rest1, head2 :: rest2) ->
map2Help f rest1 rest2 (cons (f head1 head2) ys)
_ ->
ys

map3Help : (a -> b -> c -> result) -> List a -> List b -> List c-> List result -> List result
map3Help f xs1 xs2 xs3 ys =
case (xs1, xs2, xs3) of
(head1 :: rest1, head2 :: rest2, head3 :: rest3) ->
map3Help f rest1 rest2 rest3 (cons (f head1 head2 head3) ys)
_ ->
ys

map4Help : (a -> b -> c -> d -> result) -> List a -> List b -> List c -> List d -> List result -> List result
map4Help f xs1 xs2 xs3 xs4 ys =
case (xs1, xs2, (xs3, xs4)) of
(head1 :: rest1, head2 :: rest2, (head3 :: rest3, head4 :: rest4)) ->
map4Help f rest1 rest2 rest3 rest4 (cons (f head1 head2 head3 head4) ys)
_ ->
ys


map5Help : (a -> b -> c -> d -> e -> result) -> List a -> List b -> List c -> List d -> List e -> List result -> List result
map5Help f xs1 xs2 xs3 xs4 xs5 ys =
case (xs1, xs2, (xs3, xs4, xs5)) of
(head1 :: rest1, head2 :: rest2, (head3 :: rest3, head4 :: rest4, head5 :: rest5)) ->
map5Help f rest1 rest2 rest3 rest4 rest5 (cons (f head1 head2 head3 head4 head5) ys)
_ ->
ys


suite : Benchmark
suite =
let
sampleList =
List.range 0 4999
in
describe "mapping"
[ Benchmark.compare "map2"
"no kernel"
(\_ -> map2 (\a b -> a + b) sampleList sampleList)
"core"
(\_ -> List.map2 (\a b -> a + b) sampleList sampleList)
, Benchmark.compare "map3"
"no kernel"
(\_ -> map3 (\a b c -> a + b + c) sampleList sampleList sampleList)
"core"
(\_ -> List.map3 (\a b c -> a + b + c) sampleList sampleList sampleList)
, Benchmark.compare "map4"
"no kernel"
(\_ -> map4 (\a b c d -> a + b + c + d) sampleList sampleList sampleList sampleList)
"core"
(\_ -> List.map4 (\a b c d -> a + b + c + d) sampleList sampleList sampleList sampleList)
, Benchmark.compare "map5"
"no kernel"
(\_ -> map5 (\a b c d e -> a + b + c + d + e) sampleList sampleList sampleList sampleList sampleList)
"core"
(\_ -> List.map5 (\a b c d e -> a + b + c + d + e) sampleList sampleList sampleList sampleList sampleList)
]
52 changes: 52 additions & 0 deletions custom-core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#! /usr/bin/env bash

set -o errexit;
set -o nounset;

if [[ ! -v ELM_HOME ]]; then
printf "Please set ELM_HOME!\n"
exit 1
fi

printf "Sucess if ends with DONE: "

ELM="${ELM:-elm}"
ELM_VERSION="$($ELM --version)"

cd $1

CORE_VERSIONS_DIR="$ELM_HOME/$ELM_VERSION/packages/elm/core"

if [[ -d "$CORE_VERSIONS_DIR" ]]; then

CORE_VERSION_COUNT=$(ls "$CORE_VERSIONS_DIR" | wc -l)
CORE_VERSION=$(ls "$CORE_VERSIONS_DIR")
CORE_PACKAGE_DIR="$CORE_VERSIONS_DIR/$CORE_VERSION"

if [ $CORE_VERSION_COUNT == 1 ] && \
[[ -f $CORE_PACKAGE_DIR/custom ]] && \
[[ -d "$ELM_HOME/$ELM_VERSION/packages/elm/time" ]] && \
[[ -d "$ELM_HOME/$ELM_VERSION/packages/elm/random" ]] ; then
printf "REFRESH "
else
printf "INIT "
./init-elm-home.sh > /dev/null
fi
else
printf "INIT "
./init-elm-home.sh > /dev/null
fi

CORE_VERSION=$(ls $CORE_VERSIONS_DIR)
CORE_PACKAGE_DIR="$CORE_VERSIONS_DIR/$CORE_VERSION"

./stub.py "$ELM_HOME/$ELM_VERSION/packages/elm/time"
./stub.py "$ELM_HOME/$ELM_VERSION/packages/elm/random"

rm -rf "$CORE_PACKAGE_DIR" > /dev/null
mkdir "$CORE_PACKAGE_DIR"
cp -r src "$CORE_PACKAGE_DIR"/ > /dev/null
cp -r elm.json "$CORE_PACKAGE_DIR"/ > /dev/null
touch "$CORE_PACKAGE_DIR/custom"

printf "DONE\n"
33 changes: 33 additions & 0 deletions design-documents/OperatorExample.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module OperatorExample exposing (..)

import Platform


compositionExample : (Float -> Float -> Float)
compositionExample x =
mean 6
>> mean x


mean : Float -> Float -> Float
mean a b =
(a + b) / 2


ident : Bool -> Bool
ident b =
not (not b)


main =
let
m = compositionExample 21 4

_ = ident True
in

Platform.worker
{ init = \() -> (m, Cmd.none)
, update = \model _ -> (model, Cmd.none)
, subscriptions = \_ -> Sub.none
}
1 change: 1 addition & 0 deletions design-documents/elm-minimal-master/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/elm-stuff/
24 changes: 24 additions & 0 deletions design-documents/elm-minimal-master/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.1",
"elm/core": "1.0.2",
"elm/html": "1.0.0"
},
"indirect": {
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
Loading