Commit graph

138 commits

Author SHA1 Message Date
evancz
989d878ac5 Merge branch 'master' into dev
Conflicts:
	compiler/Model/Ast.hs
	compiler/Types/Constrain.hs
2013-06-06 22:36:14 -07:00
evancz
ba5cd880d4 Merge branch 'master' of https://github.com/evancz/Elm 2013-06-06 22:30:07 -07:00
evancz
951df07b79 Only produce elmo files. The aim is to use a layout for object files similar to Go, which has thought very hard about how to make compilation really fast. 2013-06-06 22:28:24 -07:00
evancz
ad0f1f1fed Switch from sets of constraints to lists of constraints. This should have a positive performance impact, in that list insertion should be asymptotically faster than set insertion. 2013-06-06 21:36:18 -07:00
Andrew Miller
f8547cf4be Update 'at patterns' to use the as notation per mailing list discussion 2013-06-07 12:53:50 +12:00
evancz
1c80966ace Change the Haskell API for compilation to make it easier to see error messages. 2013-06-06 16:11:23 -07:00
Andrew Miller
3c71ee1c4d Support @ patterns as in Haskell 2013-06-06 21:27:20 +12:00
evancz
44fecefde6 Merge branch 'master' of https://github.com/evancz/Elm 2013-06-05 14:22:51 -07:00
evancz
212d19c3e8 Start using the given output-directory 2013-06-05 14:22:30 -07:00
evancz
f5bdb2ca7e Minor code changes to help allow custom infix precedence and associativity. 2013-06-05 14:22:11 -07:00
evancz
2d1e06b17b Start generating elmi and elmo files to permit sharing of types, values, and infix info between modules. 2013-06-05 00:44:04 -07:00
Andrew Miller
6a34482849 Add support for type annotations in let 2013-06-03 19:44:45 +12:00
evancz
6b28feaa2b Switch name of Context to Located. Whoo static types :) 2013-05-29 16:20:38 -07:00
evancz
b4bf8e9810 Get rid of ($)...
http://www.youtube.com/watch?v=a1Y73sPHKxw
2013-05-28 17:03:48 -07:00
evancz
e086c17e07 Resolve types for values imported from the standard library.
Still missing is ADT constructors in pattern matches and values from user defined modules.
2013-05-28 15:59:22 -07:00
evancz
89efcef64e Merge branch 'master' of https://github.com/evancz/Elm into type-checker-improvements 2013-05-28 14:08:31 -07:00
evancz
22042e2967 Fix issue 162: Let expressions would re-order its members such that functions always came after values. This meant that you could not use the functions to define any values within a let. 2013-05-28 07:06:14 -07:00
evancz
8ae1d112dc Turn on warning for undefined values. 2013-05-28 06:48:25 -07:00
evancz
3a369463ef Simplify code for moduleName function. 2013-05-28 06:47:57 -07:00
evancz
ce6467266f Clean up imports in many files. 2013-05-28 06:47:36 -07:00
evancz
d292236b2e Parse out types from ADT constructors.
Should help with type-checking things like the Json library.
2013-05-24 10:47:15 +02:00
evancz
f49b8ba1d2 Correct the list of the acceptable JSTypes. 2013-05-23 12:45:31 +02:00
evancz
0f76e1643c Actually show error message for bad FFI imports and exports. 2013-05-22 16:08:05 +02:00
evancz
868e71e58b Add JSObject to the FFI parser. 2013-05-22 15:59:47 +02:00
evancz
35fe7d6936 Fix missing var problem. 2013-05-21 23:47:15 +02:00
evancz
5f1e3bd696 Switch back to putting let and case expressions in closures.
In the former case it is actually necessary, in the latter, it partially fixes a mysterious bug with Dict.diff.

Also stop using the LetBoundVars module.
2013-05-21 22:28:18 +02:00
evancz
ce51a0e39f Add type-class for lists in LetBoundVars.hs 2013-05-21 22:11:23 +02:00
evancz
4eb973a206 Update Optimize.hs to use some of the newer infix operators. 2013-05-21 22:09:08 +02:00
evancz
1f1187cc74 Add open keyword to import everything. Default is now to just import the module, not to open it into local scope. 2013-05-21 10:02:59 +02:00
evancz
94bb5e5a31 Change the type of FieldState slightly. Now uses selectionStart and selectionEnd instead of the more ambiguous start and end.
Also add tons of documentation to `Graphics.Input`.

Also add the `emptyFieldState` value.
2013-05-20 15:35:44 +02:00
evancz
ee91bd91fc Allow elm-doc to handle type aliases and ADTs. 2013-05-17 12:50:01 +02:00
evancz
6c0dc8e621 Make sure elm-doc actually parses out the comments. 2013-05-16 22:11:40 +02:00
evancz
4bb23bc904 Merge branch 'dev' of https://github.com/evancz/Elm into dev 2013-05-14 16:30:36 +02:00
evancz
7ce550901c Move to initializing with three different functions: fullscreen, node, and worker.
Add code to ensure that mouse and touch positions are reported relative to the embedded Elm node.

Remove the elm_ prefix from the events for logging, redirects, and title changes. Should be silo'd by the `elm` and not escape into the global event namespace.
2013-05-14 16:29:06 +02:00
Colin Curtin
88154c04ce Fix showing compilation errors in the browser
* "Elm." is already prepended by https://github.com/evancz/Elm/blob/dev/compiler/Gen/GenerateHtml.hs#L74
2013-05-11 13:29:55 -07:00
evancz
3f8ce38f81 Rename some stuff in Graphics.Input 2013-05-06 02:30:11 -07:00
evancz
2ae0e90735 Add LineStyle to type aliases and add some annotations to the collage library 2013-05-05 12:11:45 -07:00
evancz
6b8fadac5f Fix type errors and naming mistake 2013-05-05 00:40:45 -07:00
evancz
5b3e7e15e3 Add KeyCode alias. 2013-05-04 19:01:42 -07:00
evancz
ef1275e5a1 Add Touch and TextState aliases. 2013-05-04 18:58:10 -07:00
evancz
b359fd0b47 Revise elm-docs to copy the names of type variables in type annotations directly. 2013-05-04 18:19:54 -07:00
evancz
6ca373bdeb Move Geometry into Collage. Get rid of Graphics prefix as appropriate. 2013-04-28 20:57:48 -07:00
evancz
dab4b7c7b8 Switch from ($) to (|>) and (<|). 2013-04-24 22:26:01 -07:00
evancz
ac67dbd87f Take out the F# inspired composition operators. I think this needs to wait until type-classes / monads / arrows are more figured out. 2013-04-22 10:24:37 -07:00
evancz
00d3ad2db6 Shorten Libraries.hs, and fix some types in some of the libraries. 2013-04-22 02:36:11 -07:00
evancz
29384b771a Add some operators from F#: |>, <|, <<, and >> 2013-04-21 13:59:12 -07:00
evancz
530bc6e2b9 Fix how types are converted to strings. This actually fixes some bugs that come from generating docs.json, which led to incorrect types being used in the compiler. 2013-04-09 22:12:31 -07:00
evancz
7d03f69f8c Provide a way to define super-types in type annotations. Should not be used outside of core libraries. 2013-04-09 19:50:56 -07:00
evancz
cf2357f527 Remove testing via unsafePerformIO 2013-04-09 19:49:35 -07:00
evancz
c2fc03ca0f Dealias more reliably during unification 2013-04-09 10:05:00 -07:00
evancz
5d536d129a Get prelude added in all cases. 2013-04-08 01:48:30 -07:00
evancz
703508f1c3 Fix prelude imports and correctly generalize for library types that use Number. 2013-04-07 17:55:34 -07:00
evancz
ebb570d462 Take out parens for record access. I am only fairly certain that this is okay. 2013-04-07 17:53:52 -07:00
evancz
bef646a3f1 Cosmetic changes 2013-04-07 06:46:56 -07:00
evancz
1d04b342d8 Permit pattern matching on records in case-expressions. 2013-04-07 06:46:46 -07:00
evancz
0354fad128 Explicitly list imports for a module. 2013-04-05 09:56:37 -07:00
evancz
d7948ad914 Move script tags into header. 2013-04-05 09:56:21 -07:00
evancz
87fa86c7e8 Get type dealiasing working. 2013-04-05 09:55:30 -07:00
evancz
5faf79c6da Also hide height from the Text module, which overlaps with the Element version of the function. 2013-04-05 09:53:15 -07:00
evancz
f625a9c7d6 Fix how compiler errors are displayed in generated HTML 2013-04-05 09:51:45 -07:00
evancz
1af2ff9a01 Get the API for Language.Elm in better shape. Trying to get elm-lang.org working again. 2013-04-04 10:37:43 -07:00
evancz
82f888cb3d Get the type-checker running based on docs.json information. Also add rules for Nil and Tuple0, Tuple2, etc. 2013-04-04 01:09:35 -07:00
evancz
ab62612332 Ensure that --make skips trying to read libraries as files. 2013-04-03 10:27:23 -07:00
evancz
294fdfdaa5 Add prelude in compiler with flag. Re-add the hiding option for modules internally. 2013-04-03 00:32:21 -07:00
evancz
22bfcb83cf Add the --no-prelude flag for compiling the standard libraries. Clean up code to handle flags. Change name of --generate-noscript to --noscript (this flag can probably be taken out actually) 2013-04-01 01:05:41 -07:00
evancz
2ee23724f9 Fix nested pattern matching in let expressions. 2013-03-29 19:26:50 -07:00
evancz
9c8dfd9b68 Give better name for errors when parsing docs.json 2013-03-28 10:01:15 -07:00
ngunn
b6872d4bac Singleton Nil consequential change to compiler (minor)
CompileToJS generates objects using "ctor:"... for all non-primitives.
Added special handling for lists

Might be better to have a separate tag instead of: Data "Nil"

Test case:
main_join = let f x xs = (x::xs)
    in asText $ zipWith f ['c','m','t'] ["hop","ill","ape"]

 before fails with "xs: undefined".
2013-03-26 01:04:19 +00:00
evancz
87a275abeb Fix bugs:
* types rendered "::" instead of ":"
* `Signal.count` was broken
* Prelude didn't have `show`
2013-03-24 19:17:21 -07:00
ngunn
175f268622 Fix cabal install missing docs.json (followup)
See: 14e32add30
for discussion on first attempt

Changed Librarys.hs and LoadLibraries.hs from TemplateHaskell to usafeIO.
Avoids needing to touch LoadLibraries after we change docs.json (as the file is loaded at runtime).
Also removes need for using CPP
Drawback of using unsafeIO is fairly well known/understood + this is a classic use-case.
Added error handling to LoadLibraries.hs

Setup.hs now uses "runProcess" instead of "system" to invoke elm compiler.
This allows us to set the environment variable "Elm_datadir" which is picked up by LoadLibraries and makes sure we get the just-built version in dist/data.
Also explicitly sets the RTS file to make sure we're not using one (as we're currently building it!)
Also change the folder the compiled JavaScript ends up in to dist/js.  Writing to the source tree, then deleting isn't very nice + this should make it easier to find elm compilation errors.  cabal clean handles the file deletion, too.

I think this fixes all the defects of the first version:
1. CPP is not needed
2. touch is not needed
3. building elm-runtime.js uses dist/data/docs.json
4. running elm after install uses the installed elm-runtime.js and docs.json
5. LoadLibraries.hs is simpler.  Doesn't use CPP or TemplateHaskell.  Has error handling and a decent error message
6. cabal clean && cabal install builds everything with the right data in the right order

(tested on ghc 7.4.1)
2013-03-22 15:52:40 +00:00
ngunn
14e32add30 Fix cabal install missing docs.json
See: https://github.com/evancz/Elm/issues/120

Add build-hook to Setup.hs so that elm-doc gets build and executed before library or elm exec gets built.
Add preprocessor to Elm.cabal so LoadLibraries.hs can load docs.json from the build folder instead of installed folder
Add touch to Setup.hs otherwise LoadLibraries.hs doesn't get recompiled.  This is non-portable, but I can't find a portable way (see Setup.hs for details)

cabal clean && cabal install now works
(tested on ghc 7.4.1)
2013-03-21 13:31:55 +00:00
ngunn
0064813300 trivial Docs.hs (generating docs.json missing " on type line)
Was a quote before the type value, but not after, leading to unhelpful error:
elm: Illegal unescaped character in string:
2013-03-21 13:27:04 +00:00
evancz
131a2b6818 Get sprites working in collage. temporary fix for docs.json issue. Looks like git thinks we're in the past, so a bunch of changes that have already happened as well. 2013-03-21 02:29:23 -07:00
evancz
7dbb052b22 Load json representation of types with Template Haskell, so library files are the base truth of type information.
Make minor fixes in libraries, such as adding the Char labrary and fixing the types in the Dict library.
2013-03-16 22:24:18 -07:00
evancz
96ef98417c Change such that import imports all by default. Too annoying the other way. Write a linter for that.
Also make imports a bit more concise in generated JS.
2013-03-16 13:02:01 -07:00
evancz
99ae5c6ba0 Finish moving the compiler down a directory. 2013-03-16 12:07:32 -07:00
evancz
1822ebc160 Move the compiler down a directory, mostly. 2013-03-16 12:04:05 -07:00
evancz
602bffa623 Save characters on imports. 2013-03-16 11:56:47 -07:00
ngunn
628f622f43 Fix Elm.cabal missing elm-runtime.js (follow-up)
Cut+paste error
Obviously, we want the js and the elm files, not the elm files twice.
2013-03-14 16:28:02 +00:00
ngunn
ef4d1db45a Fix Elm.cabal missing elm-runtime.js
Move Build.hs (which builds elm-runtime.js) into a cabal build step (in compiler folder)
The elm exec and runtime should never get out of sync
Having a separate Build.hs file also causes problems when using cabal-dev

Moving elm-runtime.js into the dist/ folder also shows that it's generated (and cabal clean will remove it)

Similar for types.json (although whether this should be part of the build step, I don't know)
2013-03-14 14:28:49 +00:00
evancz
6761fbb695 Switch one of the names in the JSON representation of type info. 2013-03-14 01:47:29 -07:00
evancz
42b4d5531f Add the Docs.hs file that extracts type annotations. 2013-03-14 01:04:51 -07:00
evancz
a1b890adc3 Lots of tiny fixes to get the RTS working! 2013-03-12 00:48:11 -07:00
evancz
10f0a24449 Add the very important Signal library :P
Remove past versions of the RTS.
2013-03-10 19:03:42 -07:00
evancz
29a2ec36bb Move css into RTS. Simplifies Haskell API and compiler code. 2013-03-10 18:52:16 -07:00
evancz
a5435e8993 Clean up generated JS. Ensure that imports actually happen. Fix bugs with (<~) and (~). 2013-03-10 00:02:10 -08:00
evancz
05631f2b37 Update generated JS so that the FFI works independently for each RTS. 2013-03-09 18:59:55 -08:00
evancz
1fcbec65aa Rename elm/ to compiler/ to make things clearer. 2013-03-07 11:05:53 -08:00