Skip to content

Commit

Permalink
Merge branch 'master' into webgl
Browse files Browse the repository at this point in the history
Conflicts:
	server/elm-server.cabal
  • Loading branch information
process-bot committed May 1, 2014
2 parents 8c6e080 + adaa65f commit b080f8d
Show file tree
Hide file tree
Showing 65 changed files with 916 additions and 567 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ data
build
cache
*~
tests/elm/build/
tests/elm/cache/
tests/elm/exe.js
node_modules/
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "IO"]
path = IO
url = https://github.com/maxsnew/IO.git
[submodule "automaton"]
path = automaton
url = https://github.com/evancz/automaton.git
[submodule "Elm-Test"]
path = Elm-Test
url = https://github.com/deadfoxygrandpa/Elm-Test.git
39 changes: 20 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@ describes the basic standards for opening pull requests:

## Branches

* The master branch of Elm is for tagging previous releases
and non-breaking changes, like bug fixes. This branch is
handy for folks who want to build the most recent public
release from source.
* [The master branch](https://github.com/elm-lang/Elm/tree/master) is the
home of the next release of the compiler so new features and improvements
get merged there. Most pull requests should target this branch!

* The dev branch is where the most active development occurs.
It is the home of the next release of the compiler so new
features and improvements get merged there.
* [The stable branch](https://github.com/elm-lang/Elm/tree/stable) is for
tagging previous releases and critical bug fixes. This branch is handy for
folks who want to build the most recent public release from source.

If you are working on a fairly large feature, we will probably want to merge it
in as its own branch and do some testing before bringing it into the master
branch. This way we can keep releases of the master branch independent of new
features.

## Opening a pull request

**Please open PRs against the [dev branch of
Elm](http://github.com/evancz/elm/tree/dev) whenever possible.** Changes that
are compatible with the API of master will be merged to master as soon as
possible. Changes that affect Elm's API will be merged to master with a future
release of the compiler.
**Please open PRs against the [master branch of
Elm](http://github.com/elm-lang/elm/tree/master) whenever possible.**

Note that changes in the master branch of [Elm](https://github.com/evancz/Elm/)
Note that changes in the master branch of [Elm](https://github.com/elm-lang/Elm/)
are able to be compiled against the master branch of the [elm-lang.org
repo](https://github.com/evancz/elm-lang.org), and the dev branch of
[Elm](https://github.com/evancz/Elm/) is able to be built with the dev branch of
the [elm-lang.org repo](https://github.com/evancz/elm-lang.org). Please make
sure that your changes maintain this compatibility.
repo](https://github.com/elm-lang/elm-lang.org), and the stable branch of
[Elm](https://github.com/elm-lang/Elm/) is able to be built with the stable
branch of the [elm-lang.org repo](https://github.com/elm-lang/elm-lang.org).
Please make sure that your changes maintain this compatibility.

## Licensing

You should sign the [contributor agreement](ContributorAgreement.pdf)
and send it to <info@elm-lang.org> before opening your pull request.
You need to sign the [contributor agreement](ContributorAgreement.pdf)
and send it to <info@elm-lang.org> before opening your pull request.
1 change: 1 addition & 0 deletions Elm-Test
Submodule Elm-Test added at 191185
44 changes: 27 additions & 17 deletions Elm.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: Elm
Version: 0.12
Version: 0.12.1
Synopsis: The Elm language module.
Description: Elm aims to make client-side web-development more pleasant.
It is a statically/strongly typed, functional reactive
Expand Down Expand Up @@ -27,7 +27,7 @@ Cabal-version: >=1.9

source-repository head
type: git
location: git://github.com/evancz/Elm.git
location: git://github.com/elm-lang/Elm.git

Library
exposed-modules: Elm.Internal.Dependencies,
Expand Down Expand Up @@ -95,8 +95,9 @@ Library
Paths_Elm

Build-depends: aeson,
aeson-pretty,
base >=4.2 && <5,
binary >= 0.6.4.0,
binary >= 0.7.0.0,
blaze-html >= 0.5 && < 0.8,
blaze-markup,
bytestring,
Expand Down Expand Up @@ -178,8 +179,9 @@ Executable elm
Paths_Elm

Build-depends: aeson,
aeson-pretty,
base >=4.2 && <5,
binary >= 0.6.4.0,
binary >= 0.7.0.0,
blaze-html >= 0.5 && < 0.8,
blaze-markup,
bytestring,
Expand Down Expand Up @@ -224,7 +226,7 @@ Executable elm-doc
Build-depends: aeson,
aeson-pretty,
base >=4.2 && <5,
binary >= 0.6.4.0,
binary >= 0.7.0.0,
bytestring,
cmdargs,
containers >= 0.3,
Expand All @@ -239,35 +241,33 @@ Executable elm-doc
text,
union-find

Test-Suite test-elm
Test-Suite compiler-tests
Type: exitcode-stdio-1.0
Hs-Source-Dirs: tests, compiler
Main-is: Main.hs
Hs-Source-Dirs: tests/hs, compiler
Main-is: CompilerTest.hs
other-modules: Tests.Compiler
Tests.Property
Tests.Property.Arbitrary
SourceSyntax.Helpers
SourceSyntax.Literal
SourceSyntax.PrettyPrint
build-depends: base,
directory,
Elm,
test-framework,
build-depends: test-framework,
test-framework-hunit,
test-framework-quickcheck2 >= 0.3,
HUnit,
pretty,
QuickCheck >= 2 && < 3,
filemanip,
aeson,
aeson-pretty,
base >=4.2 && <5,
binary >= 0.6.4.0,
blaze-html == 0.5.* || == 0.6.*,
blaze-markup == 0.5.1.*,
binary >= 0.7.0.0,
blaze-html,
blaze-markup,
bytestring,
cmdargs,
containers >= 0.3,
directory,
Elm,
filemanip,
filepath,
indents,
language-ecmascript >=0.15 && < 1.0,
Expand All @@ -280,3 +280,13 @@ Test-Suite test-elm
transformers >= 0.2,
union-find,
unordered-containers

Test-Suite lib-tests
Type: exitcode-stdio-1.0
Hs-Source-Dirs: tests/hs
Main-is: LibTest.hs
build-depends: base,
directory,
Elm,
filepath,
process
1 change: 1 addition & 0 deletions IO
Submodule IO added at 9fcf0c
57 changes: 11 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,20 @@ Learn about the Elm programming language at [elm-lang.org](http://elm-lang.org/)

## Install

**Arch Linux** &mdash; follow [these directions](https://github.com/elm-lang/Elm/wiki/Installing-Elm#arch-linux) and then
jump to the [My First Project](#my-first-project) section.
<br/>
**OS X 10.9 or XCode 5** &mdash; follow
[these directions](http://justtesting.org/post/64947952690/the-glasgow-haskell-compiler-ghc-on-os-x-10-9)
before continuing with the platform agnostic directions below.
Follow [these instructions][installer] if you just want to use Elm. To build
the compiler from source, run the following commands:

**Platform Agnostic** &mdash;
download the [Haskell Platform 2012.2.0.0 or later](http://hackage.haskell.org/platform/).
Once the Haskell Platform is installed:
[installer]: https://github.com/elm-lang/elm-platform/blob/master/README.md#elm-platform

cabal update
cabal install elm
cabal install elm-server
```bash
git clone https://github.com/elm-lang/Elm.git
cd Elm
cabal configure
cabal build
```

## Use

To use `elm` and `elm-server` you may need to add a new directory to your PATH.

Cabal should tell you where your executables are located upon
successful installation. It'll be something like `/home/evan/.cabal/bin`
which you should append to your PATH variable.
See this tutorial if you are new to changing your PATH in
[Unix/Linux](http://www.cyberciti.biz/faq/unix-linux-adding-path/).

## My First Project

Now we will create a simple Elm project.
The following commands will set-up a very basic project and start the Elm server.

mkdir helloElm
cd helloElm
printf "import Mouse\n\nmain = lift asText Mouse.position" > Main.elm
elm-server

The first two commands create a new directory and navigate into it. The `printf`
commands place a simple program into `Main.elm`. Do this manually if you do not
have `printf`. The final command starts the Elm server at [localhost:8000](http://localhost:8000/),
allowing you to navigate to `Main.elm` and see your first program in action.

#### Final Notes

The `elm` package provides
[some utility functions](http://hackage.haskell.org/package/Elm) for
working with Elm in Haskell. This can be useful for creating tooling
for Elm, and has been useful for projects like
[the website](http://elm-lang.org/) and
[`elm-get`](https://github.com/elm-lang/elm-get). Email the list if you
want to rely on these functions!
This will build the compiler in `/dist/build/elm/elm` but it will not be on
your PATH.

If you are stuck, email
[the list](https://groups.google.com/forum/?fromgroups#!forum/elm-discuss)
Expand Down
1 change: 1 addition & 0 deletions automaton
Submodule automaton added at 599dca
14 changes: 8 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@

## 0.13
## 0.12.1

## Improvements:

* New Array library (thanks entirely to @Xashili)
* Json.Value can flow through ports
* Improve speed and stack usage in List library (thanks to @maxsnew)
* Add Dict.filter and Dict.partition (thanks to @hdgarrood)

#### Breaking Changes:

* Revamp Json library, simpler with better names
* Revamp JavaScript.Experimental library to have slightly better names
* Remove JavaScript library which was made redundant by ports

## Improvements:

* Json.Value can flow through ports, so you can bring in values even
if they don't conform to a consistent type.

## 0.12

#### Breaking Changes:
Expand Down
45 changes: 41 additions & 4 deletions compiler/Elm/Internal/Dependencies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import Control.Applicative
import Control.Monad.Error
import qualified Control.Exception as E
import Data.Aeson
import Data.Aeson.Encode.Pretty
import qualified Data.List as List
import qualified Data.ByteString.Lazy as BS
import qualified Data.HashMap.Strict as Map
import qualified Data.Text as T

import qualified Elm.Internal.Name as N
import qualified Elm.Internal.Version as V
import qualified Elm.Internal.Paths as Path
Expand All @@ -22,14 +25,32 @@ data Deps = Deps
, exposed :: [String]
, elmVersion :: V.Version
, dependencies :: [(N.Name,V.Version)]
} deriving Show
} deriving (Show, Eq, Ord)

data MiniDeps = Mini [(N.Name,V.Version)]
deriving (Show, Eq, Ord)

instance ToJSON MiniDeps where
toJSON (Mini m) = toJSON m

instance FromJSON MiniDeps where
parseJSON (Object obj) = Mini <$> getDependencies obj
parseJSON _ = mzero

instance ToJSON Deps where
toJSON d = object [
"version" .= version d,
"summary" .= summary d,
"description" .= description d,
"license" .= license d,
"repository" .= repo d,
"exposed-modules" .= exposed d,
"elm-version" .= elmVersion d,
"dependencies" .= (jsonDeps . dependencies $ d)
]
where jsonDeps = Map.fromList . map (mapFst (T.pack . show))
mapFst f (a,b) = (f a, b)

instance FromJSON Deps where
parseJSON (Object obj) =
do version <- get obj "version" "your projects version number"
Expand Down Expand Up @@ -110,8 +131,24 @@ withDeps handle path =
case result of
Right bytes -> return bytes
Left _ -> throwError $
"could not find file " ++ path ++
"\n You may need to create a dependency file for your project."
"could not find " ++ path ++ " file. You may need to create one.\n" ++
" For an example of how to fill in the dependencies file, check out\n" ++
" <https://github.com/evancz/automaton/blob/master/elm_dependencies.json>"

depsAt :: FilePath -> ErrorT String IO Deps
depsAt = withDeps id
depsAt = withDeps id

-- | Encode dependencies in a canonical JSON format
prettyJSON :: Deps -> BS.ByteString
prettyJSON = encodePretty' config
where config = defConfig { confCompare = order }
order = keyOrder [ "name",
"version",
"summary",
"description",
"license",
"repo",
"exposed-modules",
"elm-version",
"dependencies"
]
4 changes: 2 additions & 2 deletions compiler/Elm/Internal/Name.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import qualified Data.Maybe as Maybe
import Data.Typeable

data Name = Name { user :: String, project :: String }
deriving (Typeable,Eq)
deriving (Typeable,Eq, Ord)

instance Binary Name where
get = Name <$> get <*> get
Expand Down Expand Up @@ -48,4 +48,4 @@ errorMsg string =
unlines
[ "Dependency file has an invalid name: " ++ string
, "Must have format user/project and match a public github project."
]
]
3 changes: 2 additions & 1 deletion compiler/Generate/JavaScript.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ include alias moduleName =

internalImports :: String -> Statement ()
internalImports name =
VarDeclStmt ()
VarDeclStmt ()
[ varDecl "_N" (obj "Elm.Native")
, include "_U" "_N.Utils"
, include "_L" "_N.List"
, include "_A" "_N.Array"
, include "_E" "_N.Error"
, varDecl "$moduleName" (string name)
]
Expand Down
Loading

0 comments on commit b080f8d

Please sign in to comment.