Evan Czaplicki
66e2a97d2a
Allow prefixes on FFI types
2013-08-01 15:37:34 -07:00
Evan Czaplicki
f9cc4516d8
Import qualified Text module by default
2013-07-31 23:47:29 -07:00
Evan Czaplicki
8f1f15cfeb
Fix pattern matching
2013-07-31 23:47:16 -07:00
Evan Czaplicki
ce527c0c07
Style change
2013-07-31 12:12:57 -07:00
Evan Czaplicki
4f595c2ca5
Eliminate dead code and reduce dependencies
2013-07-31 12:12:52 -07:00
Evan Czaplicki
a56efd851b
Check that imports actually exist in the known interfaces
2013-07-31 12:12:30 -07:00
Evan Czaplicki
2c96bf0c33
Get the haskell library working
2013-07-31 09:31:48 -07:00
Evan Czaplicki
e677f27bc5
add a type signature
2013-07-31 07:42:31 -07:00
Evan Czaplicki
a400ab140a
Get compling
2013-07-31 07:42:21 -07:00
Evan Czaplicki
3ef5284afd
Stop using the MultiWayIf extension
2013-07-30 22:57:13 -07:00
Evan Czaplicki
8006d8e54a
Report line numbers in type errors
2013-07-30 16:22:20 -07:00
Evan Czaplicki
b1f53d04ed
Pipe source locations through the type checker
2013-07-30 16:01:20 -07:00
Evan Czaplicki
c6868f1bd6
cosmetic change
2013-07-30 11:57:58 -07:00
Evan Czaplicki
a4c4cf0493
Use Location.none
less
2013-07-30 11:55:41 -07:00
Evan Czaplicki
b26edcc46e
Simplify representation of source locations
2013-07-30 11:43:42 -07:00
Evan Czaplicki
3065f58924
Support appendable types
2013-07-30 08:58:09 -07:00
Evan Czaplicki
ae6a3b36b5
Fix runtime code for comparing things
2013-07-30 08:44:23 -07:00
Evan Czaplicki
fa448548b8
Make error messages nicer
2013-07-30 08:31:05 -07:00
Evan Czaplicki
a1b7336547
Make comparable work fully and clean up code
2013-07-30 08:30:49 -07:00
Evan Czaplicki
3da8a71d00
Add ability to collect App1's into a Type constructor
...
Useful for determining if something is a Tuple or List
2013-07-30 08:29:52 -07:00
Evan Czaplicki
dfb27a7c67
Get rid of Paths_Elm to make sure things build properly for people.
2013-07-29 19:48:04 -07:00
Evan Czaplicki
1273f4deb3
Make sure that basic math operations generate the correct JS code.
2013-07-29 19:34:00 -07:00
Evan Czaplicki
25474f8310
Function args were in the reverse order!
2013-07-29 23:44:15 +02:00
Evan Czaplicki
a98a7be9f8
Export ADT constructors too
2013-07-29 23:43:57 +02:00
Evan Czaplicki
2d4afca06f
Fix JS generation
...
correct generation of binops
use correct calling conventions for defining functions
only import modules by name since everything is canonical (no more
eval!)
simplify exports
have _op be a per module object (resolves "overwriting" problem)
2013-07-29 23:22:33 +02:00
Evan Czaplicki
2f6d3227e9
If no exports are listed, everything gets exported
2013-07-29 23:19:32 +02:00
Evan Czaplicki
66515259cf
Only deprime when generating JavaScript, better to preserve information
2013-07-29 23:19:16 +02:00
Evan Czaplicki
f8fe8e4495
Properly convert Type.Type to SourceSyntax.Type
2013-07-29 20:23:42 +02:00
Evan Czaplicki
ac450ae944
restrict exports to def
and term
2013-07-29 19:49:09 +02:00
Evan Czaplicki
ec24738e9c
Get rid of dead code
2013-07-29 19:25:58 +02:00
Evan Czaplicki
fda1d2f979
Add canonicalization for aliases and ADTs
2013-07-29 19:25:24 +02:00
Evan Czaplicki
6ace8a0bf7
Move the definition of the Signal type out of the compiler and into the Signal library
2013-07-29 15:47:48 +02:00
Evan Czaplicki
0f3910d59e
Make SortDefinitions aware of ADT constructors, gave incorrect sorts before
2013-07-29 15:29:23 +02:00
Evan Czaplicki
46cb850570
Whitespace cleanup
2013-07-29 13:23:14 +02:00
Evan Czaplicki
3f96acf1f1
Get rid of logging and add Int, Float, Char, Bool to the global environment
2013-07-29 13:23:02 +02:00
Evan Czaplicki
2f49151c29
Cosmetic changes
2013-07-29 13:22:23 +02:00
Evan Czaplicki
ab00bce769
Remove SourceSyntax.Rename
...
I think keeping this file up to date is unnecessary
2013-07-29 13:21:59 +02:00
Evan Czaplicki
f8182740bc
Prettify code to print program
2013-07-29 13:21:34 +02:00
Evan Czaplicki
2f5639c4fb
Introduce Transform.Canonicalize
...
Run this to create a properly formatted ModuleInterface
2013-07-29 11:59:55 +02:00
Evan Czaplicki
02ab90e794
No need to derename, names will be preserved
2013-07-29 11:55:17 +02:00
Evan Czaplicki
1418bde44d
Remove use of SourceSyntax.Rename, which no longer exists
2013-07-29 11:54:50 +02:00
Evan Czaplicki
e22c7d455e
Add types and deprime
function to SourceSyntax.Helpers
2013-07-29 11:54:33 +02:00
Evan Czaplicki
eb96d7ad8d
Get rid of current canonicalization code
2013-07-29 11:53:45 +02:00
Evan Czaplicki
e8ab1c28ae
Remove SourceSyntax.Rename, which was unused
2013-07-29 11:52:34 +02:00
Evan Czaplicki
fa132ea6a8
Change name of Prelude to Basic, matching change in libraries/
2013-07-28 02:35:52 +02:00
Evan Czaplicki
0a6bd8bd96
Generate and use interfaces.data so standard library types are available
2013-07-28 02:24:17 +02:00
Evan Czaplicki
da346ea6a1
Show type errors in the order they appear in the source file
2013-07-27 00:53:34 +02:00
Evan Czaplicki
272557d785
Fix for "trying to write to a file in a non-existant directory"
2013-07-27 00:39:40 +02:00
Evan Czaplicki
fd63aff70b
Correct the code that unifies records
2013-07-27 00:15:26 +02:00
Evan Czaplicki
576e979483
Simplify code to generate record constraints
2013-07-27 00:14:38 +02:00
Evan Czaplicki
ab41d0c0e8
Take out types that were listed as "builtin"
2013-07-26 21:19:08 +02:00
Evan Czaplicki
c1d5f86e82
Simplify type error messages
2013-07-26 21:18:44 +02:00
Evan Czaplicki
42065eb075
Generate fewer intermediate variables during record unification
2013-07-26 19:39:42 +02:00
Evan Czaplicki
ebcaad0004
Fix possibility of calling maximum
on empty lists
2013-07-26 19:39:12 +02:00
Evan Czaplicki
2a51470fc1
Implement unification for records
2013-07-26 19:04:43 +02:00
Evan Czaplicki
760ad905cf
Add record constructors, begin using lists to represent fields in record types to maintain ordering from the source program
2013-07-26 18:20:57 +02:00
Evan Czaplicki
2a5bee06fc
Include type aliases from dependencies
2013-07-26 17:35:48 +02:00
Evan Czaplicki
39f2a8717d
Rewrite readDeps
so that modules are never read more than once
2013-07-26 16:38:40 +02:00
Evan Czaplicki
0f85a2fcfa
Resolve type aliases in instantiator
2013-07-26 15:08:04 +02:00
Evan Czaplicki
46631c3616
Remove dead code
2013-07-26 15:07:35 +02:00
Evan Czaplicki
637c7e0da0
Put type aliases in ModuleInterface
2013-07-26 15:06:35 +02:00
Evan Czaplicki
6948858f78
Allow multiple different imports of the same module, clean up canonicalize
code
2013-07-26 12:56:36 +02:00
Evan Czaplicki
938675110d
Fix parser for "import List" which before was not importing anything.
2013-07-26 12:31:49 +02:00
Evan Czaplicki
0681fbe583
Get rid of dead function and give instantiateTypeWithContext a shorter name
2013-07-26 12:22:15 +02:00
Evan Czaplicki
32a331b3b0
Load ADTs into the environment to fix constraint generation for patterns
2013-07-26 12:19:24 +02:00
Evan Czaplicki
2b2bc087e4
Minor cosmetic change
2013-07-26 11:40:44 +02:00
Evan Czaplicki
ff67c667a0
Get Matrix2D and Signal compiling
2013-07-26 00:33:59 +02:00
Evan Czaplicki
c19ccfe56a
Stop importing the Native library by default
2013-07-26 00:19:43 +02:00
Evan Czaplicki
727d708289
Get libraries to compile
2013-07-26 00:19:21 +02:00
Evan Czaplicki
ec8687610f
Move type annotations out of Environment and into the Basics library
2013-07-26 00:06:52 +02:00
Evan Czaplicki
eba7e6292e
Trim some unused dependencies
2013-07-25 20:53:54 +02:00
Evan Czaplicki
016a199b50
Start using Metadata.Prelude
2013-07-25 20:53:22 +02:00
Evan Czaplicki
d4b23664e4
Rename Metadata.Libraries to Metadata.Prelude
2013-07-25 20:44:41 +02:00
Evan Czaplicki
a4468d2eac
Combine two Metadata files into one
2013-07-25 20:39:23 +02:00
Evan Czaplicki
0db809ff4c
Switch formatting for language pragmas
2013-07-25 20:34:04 +02:00
Evan Czaplicki
e702370b9e
Rename a module
2013-07-25 20:21:17 +02:00
Evan Czaplicki
4c02f6ba7d
Start reworking the Metadata modules
2013-07-25 20:20:33 +02:00
Evan Czaplicki
6c808aaa47
change whitespace
2013-07-25 20:19:50 +02:00
Evan Czaplicki
9fe6c9a564
Change functions for creating type variables, distinguish names of different constraint type variables
2013-07-25 18:07:04 +02:00
Evan Czaplicki
642b1f7fcc
Properly handle constrained variables when converting from Src.Type to Type.Type
2013-07-25 17:36:52 +02:00
Evan Czaplicki
609cc3df96
Unify any constrained variables with the same super-type
2013-07-25 17:10:01 +02:00
Evan Czaplicki
a05c82f58b
Mess with whitespace
2013-07-25 17:09:23 +02:00
Evan Czaplicki
d9c1317a25
Add pretty printing for record types
2013-07-25 17:09:10 +02:00
Evan Czaplicki
d059c362d9
Fix the type of String literals
2013-07-25 16:02:49 +02:00
Evan Czaplicki
abb6dc19f6
Prettier printing for infix functions like div
2013-07-25 15:55:55 +02:00
Evan Czaplicki
b6144aeb07
Properly unify constrained variables, serious changes here!!!
...
I also rewrote merge1 and merge2 which are dangerous functions to touch.
2013-07-25 15:48:58 +02:00
Evan Czaplicki
856360bd94
Get rid of unused part of the type error message
2013-07-25 15:46:48 +02:00
Evan Czaplicki
4e7ef5f177
Add definitions for functions that act on numbers and comparables
...
This will get moved into Elm code eventually
2013-07-25 14:54:21 +02:00
Evan Czaplicki
d456cec5c8
Overload literal numbers without a decimal point to be either Ints or Floats
2013-07-25 01:25:17 +02:00
Evan Czaplicki
82ca695dca
Add support for "number" type which can be either an Int or Float
2013-07-25 01:24:16 +02:00
Evan Czaplicki
666d9f8ca3
Assume all variables with the "Native." prefix exist and have type "a"
2013-07-25 01:23:30 +02:00
Evan Czaplicki
2609f5dda7
Add support for let (==>) = Lambda in …
2013-07-23 17:00:05 +02:00
Evan Czaplicki
7b90975dad
Simplify code to check for structural errors
2013-07-23 16:15:56 +02:00
Evan Czaplicki
8ffcf9e80e
Prettier printing for infix operator definitions
2013-07-23 15:43:21 +02:00
Evan Czaplicki
802be96e57
Fix issue in which patterns could become too general
2013-07-23 15:32:08 +02:00
Evan Czaplicki
175798f6d2
Fix type constraints for case-expressions
2013-07-23 14:59:53 +02:00
Evan Czaplicki
f37e05af5e
Fix type constraints for PData
...
Was generating functions based on free type variables, not on the kind
of the constructor.
2013-07-23 14:59:34 +02:00
Evan Czaplicki
d15d84deba
Get patterns to type-check with the value in the case expression
2013-07-22 15:10:48 +02:00
Evan Czaplicki
eaa751d987
Make pretty printing for types prettier
2013-07-22 14:52:57 +02:00
Evan Czaplicki
138e99cc81
Begin to canonicalize imported values and types
2013-07-22 14:42:45 +02:00
Evan Czaplicki
eb722a20dc
Make a type less general
2013-07-22 14:41:55 +02:00
Evan Czaplicki
d9471f6c62
Add flexible variables for type annotated values
...
Without this, things are not generalized properly.
2013-07-22 14:41:12 +02:00
Evan Czaplicki
6f94400f2d
Begin parsing types and patterns such as A.B.C
2013-07-22 14:40:32 +02:00
Evan Czaplicki
97bd68a796
Make parse errors print more nicely
2013-07-22 14:40:00 +02:00
Evan Czaplicki
81522b306a
Make cross-module types aware of user-specified aliases
2013-07-22 00:23:26 +02:00
Evan Czaplicki
c140d690fc
First draft of cross-module type checking
...
Currently, all top-level types are imported. No alias resolution
happens so you need to use "import open M" atm.
2013-07-21 22:50:48 +02:00
Evan Czaplicki
4bcde7e799
Add flag for printing a whole program
2013-07-21 22:49:42 +02:00
Evan Czaplicki
1f8b7bbc98
Introduce TypeLibrary alias, a minor cosmetic change
2013-07-21 09:23:01 +02:00
Evan Czaplicki
0fd1f677a5
Get things in place to pass Prelude interfaces
2013-07-21 07:17:01 +02:00
Evan Czaplicki
b1dd1574a8
Begin passing module interfaces when compiling dependencies
2013-07-21 07:14:13 +02:00
Evan Czaplicki
22f7f8a43a
Create a serializable interface for a module's type information
...
Also add a flag to print out top-level types
2013-07-21 06:08:08 +02:00
Evan Czaplicki
fa11f8e390
get rid of unused imports
2013-07-21 00:15:35 +02:00
Evan Czaplicki
5cb82c6891
Add support for "(,,) a b c" as a valid type annotation
2013-07-20 18:53:41 +02:00
Evan Czaplicki
1a4732a436
Start building a .elmi file that contains the types of all top-level functions
2013-07-20 18:53:15 +02:00
Evan Czaplicki
c9a1cc96f6
Minor reformatting and removing unused dependencies
2013-07-20 18:52:43 +02:00
Evan Czaplicki
23758290d9
Improve pretty printing for types
2013-07-19 19:17:51 +02:00
Evan Czaplicki
9592d286bb
Start using Data.Graph to work out dependency problems and other minor tweaks
...
Print out the saved type environment, and get things working with the
program field in MetadataModule.
2013-07-19 18:05:31 +02:00
Evan Czaplicki
ca4502b70a
Save the current environment on CSaveEnv
2013-07-19 18:03:28 +02:00
Evan Czaplicki
b0f96a2eab
Switch from [Def t v] to (LExpr t v) for program representation
2013-07-19 18:02:24 +02:00
Evan Czaplicki
4dc68acd60
Stop creating types for ADT's, use Constant and Flexible in the right place
2013-07-19 18:01:26 +02:00
Evan Czaplicki
4c0f716aef
Change the representation of SolverState to have a "saved environment", recognize the "Save the Environment" variable
2013-07-19 17:50:16 +02:00
Evan Czaplicki
807076ad57
Add CSaveEnv, optimize CAnd, make it prettier
...
CSaveEnv is a special constraint that indicates that the current
environment should be saved for later use.
(/\) now optimizes away arguments that are already CTrue.
2013-07-19 17:48:41 +02:00
Evan Czaplicki
648cbd49dd
Use letters for arguments in adt constructors
2013-07-19 17:46:03 +02:00
Evan Czaplicki
c942afea6a
Nicer pretty printing and a special variable to "Save the Environment"
2013-07-19 17:45:16 +02:00
Evan Czaplicki
c1aef789ee
Flatten lets only during JavaScript generation
2013-07-19 17:43:37 +02:00
Evan Czaplicki
ce652d9a35
Print errors more nicely
2013-07-19 15:40:37 +02:00
Evan Czaplicki
45b43e8757
When creating a named var, allow it to be flexible.
2013-07-19 13:25:51 +02:00
Evan Czaplicki
26738907c6
Make error message in solver slightly more specific
2013-07-19 12:41:37 +02:00
Evan Czaplicki
b540fb43b0
Fix bug in generating Def for ADT constructors
...
Accidentally used the type name instead of the constructor name.
2013-07-19 12:39:38 +02:00
Evan Czaplicki
b87e45a27d
Change module prefixes for some values
2013-07-19 11:19:51 +02:00
Evan Czaplicki
c881bd8ef2
Fix bug in type application when converting SourceSyntax.Type to Type.Type
...
Also get rid of some print statements.
2013-07-18 18:16:54 +02:00
Evan Czaplicki
901179c10f
Marginally better errors when a variable is undefined.
2013-07-17 19:30:40 +02:00
Evan Czaplicki
a3a7b3ef62
Refactor type environment
...
Migrate some functions to Environment.hs, add built-in types like _List
and _Tuple2.
2013-07-17 19:29:27 +02:00
Evan Czaplicki
90c5c7d21c
Add terse way to do type application
2013-07-17 19:26:42 +02:00
Evan Czaplicki
334d39c644
Manual dead code elimination ;)
2013-07-17 19:25:17 +02:00
Evan Czaplicki
1d1083600f
Fix naming bug for List type
2013-07-17 19:24:56 +02:00
Evan Czaplicki
e852ae25e3
Add field to MetadataModule for datatypes
2013-07-17 19:24:40 +02:00
Evan Czaplicki
fceb46dd4e
Try to support polymorphic pattern matching
...
Expands each pattern into basic PVars to attempt to recover polymorphis
through the same mechanism. Need to test further.
2013-07-16 21:46:06 +02:00
Evan Czaplicki
3bb618bcde
Provide the type *and definition* for data constructurs during type checking
2013-07-16 21:44:41 +02:00
Evan Czaplicki
82983a6f24
Update more modules to use the MetadataModule data structure
2013-07-16 21:43:56 +02:00
Evan Czaplicki
8145e600fc
Create MetadataModule for more refined information about modules
...
Used in most places to break a module into more orthogonal components.
Some of this data needs to be serialized into the interface files.
2013-07-16 21:42:37 +02:00
Evan Czaplicki
621a9c2d2e
Add a way to flatten lets that have become nested
2013-07-16 21:40:11 +02:00
Evan Czaplicki
0cfae2e43b
More specific imports
2013-07-16 21:38:43 +02:00
Evan Czaplicki
640f98e7d5
Rename functions and modules
2013-07-16 21:38:20 +02:00
Evan Czaplicki
1ffaad1f5c
Create an isOp
function for strings.
2013-07-16 21:37:48 +02:00
Evan Czaplicki
91be5a0c03
Rename the parser.
2013-07-16 16:02:04 +02:00
Evan Czaplicki
ce357b3d0d
Switch to reporting errors with [Doc] for prettier layout.
2013-07-16 14:52:50 +02:00
Evan Czaplicki
1c9da4bf9c
Force whitespace between number and operator in infix declarations.
2013-07-16 14:50:35 +02:00
Evan Czaplicki
8590c6bd18
Add parsing for infix declarations. No support for actually using this
...
information though.
2013-07-16 14:39:58 +02:00
Evan Czaplicki
72bd5cb8eb
Clean out this file, getting rid of dead code and adding some types.
2013-07-16 14:39:26 +02:00
Evan Czaplicki
a5bc960067
Minor cosmetic changes
2013-07-16 00:40:11 +02:00
Evan Czaplicki
67ef1ec77b
Create the Type.Inference module which handles type inference from
...
start to finish. Give it a Module and it returns a dictionary mapping
top-level values to types.
2013-07-16 00:38:31 +02:00
Evan Czaplicki
18adffc06d
Turn unary negation back on.
2013-07-16 00:36:34 +02:00
Evan Czaplicki
90d50dbb13
Turn off unary negation parsing for now. It has weird behavior when
...
paired with function calls:
(- sqrt 9) -- parse error
(-sqrt 9) -- type error, cannot negate function
-(sqrt 9) -- this works
- (sqrt 9) -- parse error
- sqrt 9 -- parse error
2013-07-15 12:22:04 +02:00
Evan Czaplicki
2b9886336f
Fix parsing of unary negation when it is the first thing in parentheses.
2013-07-15 11:53:53 +02:00
Evan Czaplicki
93a948cd67
Add back in checks for duplicate and out-of-order definitions.
2013-07-15 01:06:00 +02:00
Evan Czaplicki
0070a844d0
Switch the internal data constructor name for tuples. Before tuple
...
constructors could be shadowed by user defined ADT's such as "Tuple0",
"Tuple2", etc. Now it uses "_Tuple0" to make it impossible to overlap
with user defined ASTs.
2013-07-14 19:52:50 +02:00
Evan Czaplicki
343dcf2250
Add support for unary negation with the '-' symbol. Makes the use of
...
'-' whitespace sensitive, as in the unary negation proposal in
elm-discuss.
f -1 == f (0-1)
x - 1 == (x-1)
x-1 == (x-1)
2013-07-14 17:55:38 +02:00
Evan Czaplicki
08ff939174
Be more flexible with the position of the closing bracket of a record type.
2013-07-14 14:55:29 +02:00
Evan Czaplicki
fe7357a0b5
Export boundVars function, which is currently reeded to generate JS.
2013-07-14 01:41:52 +02:00
Evan Czaplicki
87d2f8d57d
Get declarations parsing properly. The definition parser needs to be
...
the last option.
2013-07-14 01:41:03 +02:00
Evan Czaplicki
2b9853ce9b
Get variable reordering working for Declarations.
2013-07-13 13:44:40 +02:00
Evan Czaplicki
fe23c0e66d
fix pretty printer for chars
2013-07-13 01:05:48 +02:00
Evan Czaplicki
7f433922ed
Create module to sort let-blocks into "strongly connected components".
...
This does two things:
* makes it possible to automatically generalize functions without
bothering the programmer about managing dependencies.
* sorts values such that they'll be defined in the appropriate order
when they are mapped down to JavaScript.
2013-07-12 22:24:12 +02:00
Evan Czaplicki
4d7562f317
Begin generating constraints for whole programs. Need to perform
...
dependency sort within let-expressions for things to work properly though.
2013-07-12 16:21:07 +02:00
Evan Czaplicki
4208b5c9de
Remove some debugging stuff and generally clean up the code.
...
There was one potential error in which a debug needed to be a liftIO,
the computation it performed was not optional.
2013-07-12 11:05:03 +02:00
Evan Czaplicki
b0387821b4
Fix error in generalization in which some variables would escape their
...
rank. Problem was that young variables were not all being marked as
young.
This resolved a soundness issue described in the post on
"How OCaml type checker works".
2013-07-12 11:00:35 +02:00
Evan Czaplicki
dabada1d98
Make constraint pretty printing prettier.
2013-07-11 23:30:18 +02:00
Evan Czaplicki
cb914d91ff
Get all of the Haskell files compiling with the new type checker.
...
Does not actually work, undefined is used in some places as a
stopgap measure.
2013-07-11 12:48:37 +02:00
Evan Czaplicki
ca77056fc9
Improve quality of error messages.
2013-07-11 00:31:56 +02:00
Evan Czaplicki
b5887f41c9
Get type inference working in the basic case. Begin working on
...
printing errors in a prettier way.
2013-07-10 14:31:57 +02:00
Evan Czaplicki
f87e316847
Make pretty printing properly parenthesize higher order functions.
...
Not the best implementation, but it is simple and works well.
2013-07-09 21:59:58 +02:00
Evan Czaplicki
497d478d26
Get the solver working on basic programs. It outputs pretty types for the
...
variables in the program. Need to test further and start doing some benchmarking.
2013-07-09 21:52:05 +02:00
Evan Czaplicki
ca62ee64a9
Create type pools, have an organized model of state to flow through
...
the State Transformer during constraint solving and variable unification.
2013-07-09 10:25:50 +02:00
Evan Czaplicki
4c51159f2a
Create a Type.Pool module specifically for variable pools. Start using
...
a state transformer to thread the pool and errors through.
2013-07-08 20:03:08 +02:00
Evan Czaplicki
2ef18826de
Start adding constraint generation for declarations.
2013-07-08 18:23:18 +02:00
Evan Czaplicki
5cc99f5542
Remove the old type-checker code.
2013-07-08 16:58:09 +02:00
Evan Czaplicki
0ed72056b6
Add pretty printing for type constraints.
...
Convert source-syntax types into type-checker types and print them
with pretty type variables.
Generate constraints for let-expressions using type annotations.
Build test function to turn strings into type constraints.
2013-07-08 16:47:44 +02:00
Evan Czaplicki
96fd5bfd78
Update program parser to use Parse.Declarations
2013-07-07 22:11:16 +02:00
Evan Czaplicki
d29ca3beeb
Create a Parse.Declaration file for all declarations. Get rid of special
...
purpose Parse.Foreign library.
2013-07-07 22:06:56 +02:00
Evan Czaplicki
e4ca96731d
Create a source syntax for types that will get converted into the internal type representation during type checking.
2013-07-07 18:13:40 +02:00
Evan Czaplicki
f2b3ed7027
Start using the PrettyPrint library to show expressions, literals, and patterns.
2013-07-07 12:56:34 +02:00
Evan Czaplicki
078692ad8c
Get Optimize.hs updated for the newer AST.
2013-07-07 12:55:08 +02:00
Evan Czaplicki
b87b84556c
Move the Environment.hs and Fragment.hs files down a directory.
2013-07-07 12:54:05 +02:00
Evan Czaplicki
ca8441ff2f
Continue getting the new type-checker in order.
2013-07-07 12:52:48 +02:00
Evan Czaplicki
947b82ed09
Switch more files over to new Expressions
2013-07-04 17:31:22 +02:00
Evan Czaplicki
5c68f6bb73
Convert more files to the new Expression format that relies more on
...
patterns. Seems to clean things up so far.
Also, begin adding a module that resorts definitions to make sure
that each definition comes after the ones it depends on. This will
also make it possible to disallow recursive values statically.
2013-07-04 17:24:04 +02:00
Evan Czaplicki
69ed7631fe
Start switching over to an AST that uses patterns in lambdas and
...
pulls the arguments out of Definitions (placing them in lambdas).
2013-07-04 11:36:08 +02:00
Evan Czaplicki
351c33c486
Start generating constraints for let-expressions. Account for mutual recursion,
...
but will throw a runtime error if a user has given type annotations.
2013-07-03 19:51:38 +02:00
Evan Czaplicki
cdb63bd8d1
Start writing a new type checker based on the ATAPL chapter on efficient type-inference.
2013-07-03 14:35:51 +02:00
Evan Czaplicki
74d3c35131
Fix optimization bug with > sign.
2013-07-02 16:58:19 +02:00
Evan Czaplicki
60de915824
Merge branch 'dev' of https://github.com/evancz/Elm into dev
2013-07-01 20:05:49 +02:00
Evan Czaplicki
d700acfeac
Fix substitutions for ExplicitList.
2013-07-01 20:00:37 +02:00
Andrew Miller
1b4aca9685
Turn off debug code that printed all constraints during unify.
...
This debug code is very noisy and makes it hard to test the dev
branch because you can't see warnings buried in all the debug
output.
2013-07-01 08:43:00 +12:00
Evan Czaplicki
9d68c10683
Add support for triple-quoted multi-line strings
2013-06-27 18:55:01 +02:00
Evan Czaplicki
da9c49338a
Fix pattern matching aliases so that it works in all cases. Previously it was totally broken.
2013-06-23 04:18:27 -07:00
Evan Czaplicki
cee9f6a9d9
Add two dummy files to make it possible to build the compiler from
...
within emacs. This makes it faster to type-check things and start
testing functions.
2013-06-23 02:43:58 -07:00
Evan Czaplicki
e80ea9e430
Add support for pattern matching on literals.
2013-06-23 01:36:23 -07:00
Evan Czaplicki
c158155bdf
Switch to using (Map String String) instead of (String -> String) as the environment.
2013-06-23 01:35:04 -07:00
Evan Czaplicki
98eceb5496
Clean up Transform/Replace.hs. Switch the environment from a (String -> String) to a (Map String String).
2013-06-23 01:33:33 -07:00
Evan Czaplicki
cd83c4c8ed
Allow full expressions as the last member of binary expressions (t + t + e)
2013-06-23 01:31:34 -07:00
evancz
9a40249e05
Fix the confusion with "Cons" and "Nil" in issue #176 .
...
Also add the ExplicitList expression.
2013-06-20 21:25:10 -07:00
evancz
4a6032f239
Add file
2013-06-18 16:00:51 -07:00
evancz
afacd1b858
Add hoverable
and hoverables
2013-06-15 00:49:22 -07:00
evancz
316cd1d0ee
Add an experimental API for dev tools.
2013-06-14 21:06:54 -07:00
evancz
a9de2342dc
Solve a "non-exhaustive pattern match"
2013-06-14 19:38:03 -07:00
evancz
35981eb42f
Finish parameterizing the AST and properly check errors in let expressions.
2013-06-14 19:23:58 -07:00
evancz
d7dcf5a9e8
Get the whole compiler building again.
2013-06-13 22:59:14 -07:00
evancz
721ce4f192
Continue reorganizing the code-base.
...
Remove uses of uniplate, introduces a regression in testing the ordering of Defs in let-expressions.
2013-06-13 22:45:08 -07:00
evancz
272ecc67fd
Rename Model/ to Metadata/ because it now only holds info about the types of library functions.
2013-06-13 20:45:12 -07:00
evancz
c7dce08193
Parameterized the AST for type annotations and variable types. Also rename Guid.hs to Unique.hs which reads a lot nicer.
2013-06-13 20:25:00 -07:00
evancz
459cf8ec73
Switch parsers over to new AST
2013-06-13 19:15:40 -07:00
evancz
339ad77c46
Begin getting the parser to match the new SourceSyntax modules.
2013-06-13 18:35:37 -07:00
evancz
bbb2b2a14f
Begin migrating the AST to its own branch for the source syntax of the language.
2013-06-13 18:00:24 -07:00
evancz
73317ed123
Switch to using MultiIf for all if expressions. Simplifies AST.
2013-06-13 16:01:35 -07:00
evancz
569541e72a
Fix broken build.
2013-06-09 23:36:59 -07:00
evancz
6fc30322ce
Print out a bunch of extra information about type checking.
2013-06-09 11:15:03 -07:00
evancz
0d96f82208
Add type constructor for extensible records.
2013-06-07 10:16:38 -07:00
evancz
d629db79c2
Fix issue causing build error.
2013-06-07 09:43:58 -07:00
evancz
6e56df59a5
Switch to only generating elmo files. Turn off the CPP flags in .cabal and remove all generated JS files on each build for now.
2013-06-07 09:38:29 -07:00
evancz
28db384691
Fix parsing bug in as
patterns that would fully commit if any spaces were seen.
...
Also add `as` variables to reported variables in patterns.
2013-06-06 23:16:46 -07:00
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