Skip to content

Commit

Permalink
Merge branch 'dev' into topic/webgl
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	compiler/Generate/JavaScript.hs
	compiler/Parse/Helpers.hs
	compiler/SourceSyntax/Expression.hs
  • Loading branch information
johnpmayer committed Dec 31, 2013
2 parents 6785c5c + b0a856e commit cf016ea
Show file tree
Hide file tree
Showing 57 changed files with 619 additions and 285 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ data
.DS_Store
build
cache
*~
File renamed without changes.
46 changes: 39 additions & 7 deletions Elm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Library
Hs-Source-Dirs: compiler
other-modules: SourceSyntax.Declaration,
SourceSyntax.Expression,
SourceSyntax.Everything,
SourceSyntax.Helpers,
SourceSyntax.Literal,
SourceSyntax.Location,
Expand All @@ -55,6 +54,7 @@ Library
Generate.Markdown,
Transform.Canonicalize,
Transform.Check,
Transform.SafeNames,
Transform.SortDefinitions,
Transform.Substitute,
Transform.Optimize,
Expand Down Expand Up @@ -111,7 +111,6 @@ Library
text,
transformers >= 0.2,
union-find,
uniplate,
unordered-containers

Executable elm
Expand All @@ -120,7 +119,6 @@ Executable elm
Hs-Source-Dirs: compiler
other-modules: SourceSyntax.Declaration,
SourceSyntax.Expression,
SourceSyntax.Everything,
SourceSyntax.Helpers,
SourceSyntax.Literal,
SourceSyntax.Location,
Expand All @@ -135,6 +133,7 @@ Executable elm
Generate.Cases,
Transform.Canonicalize,
Transform.Check,
Transform.SafeNames,
Transform.SortDefinitions,
Transform.Substitute,
Transform.Optimize,
Expand Down Expand Up @@ -191,14 +190,12 @@ Executable elm
text,
transformers >= 0.2,
union-find,
uniplate,
unordered-containers

Executable elm-doc
Main-is: Docs.hs
Hs-Source-Dirs: compiler
other-modules: SourceSyntax.Declaration,
SourceSyntax.Everything,
SourceSyntax.Expression,
SourceSyntax.Helpers,
SourceSyntax.Literal,
Expand Down Expand Up @@ -235,6 +232,41 @@ Executable elm-doc

Test-Suite test-elm
Type: exitcode-stdio-1.0
Hs-Source-Dirs: tests
Hs-Source-Dirs: tests, compiler
Main-is: Main.hs
build-depends: base, directory, HTF
other-modules: Tests.Compiler
Tests.Property
Tests.Property.Arbitrary
SourceSyntax.Helpers
SourceSyntax.Literal
SourceSyntax.PrettyPrint
build-depends: base,
directory,
Elm,
test-framework,
test-framework-hunit,
test-framework-quickcheck2,
HUnit,
pretty,
QuickCheck >= 2 && < 3,
filemanip,
aeson,
base >=4.2 && <5,
binary >= 0.6.4.0,
blaze-html == 0.5.* || == 0.6.*,
blaze-markup == 0.5.1.*,
bytestring,
cmdargs,
containers >= 0.3,
directory,
filepath,
indents,
language-ecmascript >=0.15 && < 1.0,
mtl >= 2,
pandoc >= 1.10,
parsec >= 3.1.1,
pretty,
text,
transformers >= 0.2,
union-find,
unordered-containers
93 changes: 93 additions & 0 deletions How to Request Features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# How to make a Feature Request

Adding features is hard work and has long term implications for Elm.
If you think your particular feature is important, help make it happen
by doing some of the background work that goes into actually adding it.

### Before making a Request / Formatting:

- Make sure your feature has not already been requested. Look through the
email list to find similar requests.
- Submit feature requests by emailing the list. This allows the broadest
discussion and does not clutter up the GitHub repository with speculative
issues. I'd prefer to use the GitHub issue tracker for bug tracking and
issues with the existing code base.
- Label all feature requests with a subject like "Request: _____". For
example, if you want to be the umpteenth person to request type classes,
you would use the subject "Request: Type Classes".

### Body of the Request:

Your request should address all of the following issues:

**General Problem:** Clearly define the purpose of adding the feature.
What general problem do you want to solve? Why is that problem important?
Why is it important for a functional GUI language?

**Specific Use-Cases:** What are the specific cases when the general problem
is actually an issue? How often does this case come up? Why are these cases
important to easily designing graphical user interfaces? Why are existing
solutions in Elm unsuitable?

**Background Materials:** Are there relevant papers on the topic? Are there
languages or libraries that already have this feature? Organize this material
and provide a concise and helpful overview.

**Alternatives:** What are all the ways to address the general problem or a
closely related problem? For example, the semantic flexibility of type classes
can be largely replicated with a module system in the style of ML.
What are the strengths and weakness of each of the alternative solutions?

**Suggested Approach:** Outline your specific approach. How does it address
the general problem? How does it work? How hard is it going to be to add?
What other language features does it depend on that need to be added first?
Try to take a look at the relevant code to see if it would require significant
changes. If you are suggesting an API or library changes, include an interface
(a list of type signatures) for the functions you would like to add (perhaps
multiple interfaces if there are many good approaches).

**Known Issues:** Search for issues that people have already found. Think of
any other possible downside and list them too. For example, one downside of
typeclasses is that they are globally defined for each type, so you cannot
have multiple `Ord` instances for Strings. This can lead to namespace pollution
within a project. In general you can only implement an "interface" once per
type, so it is very tricky to get the flexibility of ML's module functors.

**Justification:** Why is the added complexity of your feature worth it? Discuss
both implementation complexity in the compiler, and conceptual complexity that
users must deal with. Why is your feature better than the alternative solutions?
Why is it okay to ignore the known issues? Is there any way to overcome the known
issues? Will it be difficult or confusing for users coming from JavaScript?

### Some final notes:

If for some reason you cannot provide details for some of these categories,
explain why the category is not applicable.

Re-read before posting. Is your request constructive? Is it well organized?
Are there any details you forgot? Can anything be clarified or trimmed down?
Considering a request takes time, so be considerate about how much work a
reader has to do to take it seriously.

A feature request is not an opportunity to be sassy or glib. Try to present
the information and argument clearly, concisely, thoroughly, and in an unbiased
manner.

This is likely to be an iterative process. People will have comments and
questions. Everyone please be kind. Commenters, if you think you have a
concern, raise it as a question: "But what happens when you do blah?" instead
of "This will break when you do blah". Assume you have misunderstood their
proposal or only have a shallow understanding of it. Seek clarification, not victory.

Comments are not a place for flame wars. Discuss specific issues. Vague
complaining and unsupported claims should either be forgotten or developed
into specific and well-supported concerns.

I am always working hard to add cool stuff to Elm, and it is a lot of work.
I must prioritize issues to focus on the things that have the highest impact
for improving the quality of Elm, addressing the concerns of current users,
and making Elm more appealing for new users. I do not have infinite time,
so some things must receive more attention than others. I apologize in advance.

And to summarize, just be cool! I want Elm to be really fun and easy to use,
and I want your projects to be amazing!
6 changes: 3 additions & 3 deletions compiler/Build/Dependencies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import System.FilePath as FP
import System.IO
import Text.PrettyPrint (Doc)

import SourceSyntax.Everything
import qualified SourceSyntax.Module as Module
import qualified SourceSyntax.Type as Type
import qualified Parse.Parse as Parse
import qualified Metadata.Prelude as Prelude
Expand All @@ -32,7 +32,7 @@ import qualified Elm.Internal.Name as N
import qualified Elm.Internal.Version as V
import qualified Elm.Internal.Dependencies as Deps

getSortedDependencies :: [FilePath] -> Interfaces -> FilePath -> IO [String]
getSortedDependencies :: [FilePath] -> Module.Interfaces -> FilePath -> IO [String]
getSortedDependencies srcDirs builtIns root =
do extras <- extraDependencies
let allSrcDirs = srcDirs ++ Maybe.fromMaybe [] extras
Expand Down Expand Up @@ -86,7 +86,7 @@ sortDeps depends =
mistakes = filter (\scc -> length scc > 1) sccs
msg = "A cyclical module dependency or was detected in:\n"

readDeps :: [FilePath] -> Interfaces -> FilePath -> ErrorT String IO [Deps]
readDeps :: [FilePath] -> Module.Interfaces -> FilePath -> ErrorT String IO [Deps]
readDeps srcDirs builtIns root = do
let ifaces = (Set.fromList . Map.keys) builtIns
State.evalStateT (go ifaces root) Set.empty
Expand Down
8 changes: 5 additions & 3 deletions compiler/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import System.Exit
import System.FilePath as FP
import Text.PrettyPrint (Doc)

import SourceSyntax.Everything
import SourceSyntax.Declaration
import SourceSyntax.Module
import qualified SourceSyntax.Expression as Expr
import qualified SourceSyntax.Type as Type
import qualified Parse.Parse as Parse
import qualified Metadata.Prelude as Prelude
Expand All @@ -38,7 +40,7 @@ build noPrelude interfaces source =
let exports'
| null exs =
let get = Set.toList . SD.boundVars in
concat [ get pattern | Definition (Def pattern _) <- decls ] ++
concat [ get pattern | Definition (Expr.Def pattern _) <- decls ] ++
concat [ map fst ctors | Datatype _ _ ctors <- decls ] ++
[ name | TypeAlias name _ (Type.Record _ _) <- decls ]
| otherwise = exs
Expand All @@ -49,7 +51,7 @@ build noPrelude interfaces source =
exports = exports',
imports = ims,
-- reorder AST into strongly connected components
program = SD.sortDefs . dummyLet $ TcDecl.toExpr decls,
program = SD.sortDefs . Expr.dummyLet $ TcDecl.toExpr decls,
types = Map.empty,
datatypes = [ (name,vars,ctors) | Datatype name vars ctors <- decls ],
fixities = [ (assoc,level,op) | Fixity assoc level op <- decls ],
Expand Down
8 changes: 3 additions & 5 deletions compiler/Elm/Internal/Dependencies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import qualified Data.ByteString.Lazy as BS
import qualified Data.HashMap.Strict as Map
import qualified Elm.Internal.Name as N
import qualified Elm.Internal.Version as V
import qualified Elm.Internal.Paths as Path

data Deps = Deps
{ name :: N.Name
Expand Down Expand Up @@ -47,10 +48,6 @@ instance FromJSON Deps where
Right nm -> return nm

exposed <- get obj "exposed-modules" "a list of modules exposed to users"
when (null exposed) $
fail "there are no 'exposed-modules'.\n\
\At least one module must be exposed \
\for anyone to use this library!"

elmVersion <- get obj "elm-version" "the version of the Elm compiler you are using"

Expand All @@ -76,7 +73,8 @@ get obj field desc =
case maybe of
Just value -> return value
Nothing -> fail $ "Missing field " ++ show field ++ ", " ++ desc ++ ".\n" ++
" <https://github.com/evancz/rainbow-palette/blob/master/elm_dependencies.json>"
" Check out an example " ++ Path.dependencyFile ++ " file here:" ++
" <https://github.com/evancz/automaton/blob/master/elm_dependencies.json>"

repoToName :: String -> Either String N.Name
repoToName repo
Expand Down
2 changes: 1 addition & 1 deletion compiler/Elm/Internal/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import qualified Data.Version as Version

elmVersion :: Version
elmVersion = V ns ""
where (Version.Version ns _) =This.version
where (Version.Version ns _) = This.version

-- Data representation

Expand Down
Loading

0 comments on commit cf016ea

Please sign in to comment.