git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'master' of github.com:purescript/purescript
commit2db1268b271a35d206e9031b17137facca21f307 authorjoneshf <jones3.hardy@gmail.com> dateWed 9 Apr 2014, 20:31 (13 years ago) parent5f321aa6ee0094
7 files changed+36−22
RELEASE-0.5.md+15−7 prelude/prelude.purs+6−1 purescript.cabal+6−6 src/Language/PureScript/Sugar/Names.hs+4−2 src/Language/PureScript/Sugar/TypeClasses.hs+2−3 src/Language/PureScript/TypeChecker/Monad.hs+1−1 src/Language/PureScript/TypeChecker/Types.hs+2−2
RELEASE-0.5.md+15−7
@@ -9,18 +9,23 @@
99 ...
1010
1111- Prelude modules now follow a naming scheme similar to haskell (e.g. `Data.Maybe`, `Control.Monad`) (garyb)
12+- Many modules that were previously part of the Prelude have been split into individual libraries, [now distributed via Bower](http://bower.io/search/?q=purescript) (garyb)
1213- Multiple modules with the same name are now disallowed rather than merged (garyb)
1314- The `--runtime-type-checks` flag has been removed. Runtime type checks have been superceded by the `purescript-foreign` library (paf31)
14−- The `Prelude` module is now imported automatically. Conflicts can be avoided by using qualified imports or a specific import list. (garyb, paf31)
15−- Overlapping instances are no longer allowed. The `Prelude` and core liblaries have been updated accordingly. (paf31)
15+- The `Prelude` module is now imported automatically. Conflicts can be avoided by using qualified imports or an explicit import list. (garyb, paf31)
16+- Overlapping instances are no longer allowed. The `Prelude` and core libraries have been updated accordingly. (paf31)
17+- `Functor`, `Applicative`, `Monad` are now part of a class heirarchy that include `Apply` and `Bind`. `return` is now an alias for `pure`. (joneshf, paf31, garyb)
18+- `Semigroupoid` is now a superclass of `Category` (garyb)
1619
1720### New Features
1821
19−- Let bindings are now supported. The `let` keyword can introduce several local (possibly mutually recursive) bindings, along with optional type signatures. (paf31)
2022- Multi parameter typeclasses (paf31)
23+- Superclasses (puffnfresh, paf31)
24+- FlexibleInstances and FlexibleContexts (paf31)
25+- Let bindings are now supported. The `let` keyword can introduce several local (possibly mutually recursive) bindings, along with optional type signatures. (paf31)
26+- `where` clauses are now supported in value declarations, with the same rules as `let` bindings (garyb)
2127- Empty data declarations and empty type classes are now supported (paf31)
2228- A new command line option `--codegen` controls which modules will have Javascript and externs generated (paf31)
23−- `where` clauses are now supported in value declarations (garyb)
2429
2530### Enhancements
2631
@@ -43,7 +48,7 @@
4348- Case statements and functions which do not pattern match on their arguments now generate smaller code (paf31)
4449- Imported type class instances are now exported (paf31)
4550- Some error messages were improved (paf31)
46−- Qualfied module imports are now supported as `import qualified M as X` (garyb).
51+- Qualfied module imports are now supported as `import qualified M as X` (garyb)
4752- The escape check was removed, since it was too restrictive (paf31)
4853- The binary operator reordering step was greatly simplified (paf31)
4954- The Object type constructor can now be referenced explicitly as `Prim.Object` (with kind `# * -> *`) (paf31)
@@ -51,8 +56,10 @@
5156- Unary minus and signed numeric literals are now supported again (paf31, garyb)
5257- Type errors have been simplified, the full trace can be enabled with `--verbose-errors` or `-v` (paf31)
5358- Error messages now display source positions (paf31, garyb)
54−- The type classes implementation and code generation was greatly simplified. (paf31)
55−- Object properties and row labels can now be accessed with arbitrary string names by using string literals. (paf31)
59+- The type classes implementation and code generation was greatly simplified (paf31)
60+- Object properties and row labels can now be accessed with arbitrary string names by using string literals (paf31)
61+- `(++)` is now an alias for the Semigroup operator `(<>)` (paf31)
62+- Error messages for classes with undefined or missing members have been improved (garyb)
5663
5764### Bug Fixes
5865
@@ -72,6 +79,7 @@
7279- Characters in string literals are now properly escaped (garyb)
7380- A module containing a single orphan type declaration and no other declarations now fails to compile (garyb)
7481- An error involving ordering of type class instances was fixed (garyb, paf31)
82+- Externs files no longer include fixity declarations for members that were removed as dead code (garyb)
7583
7684### Libraries
7785
prelude/prelude.purs+6−1
@@ -42,8 +42,13 @@ module Prelude where
4242 class Show a where
4343 show :: a -> String
4444
45+ foreign import showStringImpl
46+ "function showStringImpl(s) {\
47+ \ return JSON.stringify(s);\
48+ \}" :: String -> String
49+
4550 instance showString :: Show String where
46− show s = s
51+ show = showStringImpl
4752
4853 instance showBoolean :: Show Boolean where
4954 show true = "true"
purescript.cabal+6−6
@@ -1,5 +1,5 @@
11name: purescript
2−version: 0.4.17
2+version: 0.4.17.1
33cabal-version: >=1.8
44build-type: Custom
55license: MIT
@@ -19,7 +19,7 @@ data-dir: ""
1919
2020library
2121 build-depends: base >=4 && <5, cmdtheline -any, containers -any,
22− directory >= 1.2, filepath -any, mtl -any, parsec -any, syb -any,
22+ directory >= 1.2, filepath -any, mtl -any, parsec -any, syb >= 0.4.1 && < 0.5,
2323 transformers -any, utf8-string -any,
2424 pattern-arrows >= 0.0.2 && < 0.1,
2525 monad-unify >= 0.2.1 && < 0.3,
@@ -87,7 +87,7 @@ library
8787executable psc
8888 build-depends: base >=4 && <5, cmdtheline -any, containers -any,
8989 directory -any, filepath -any, mtl -any, parsec -any,
90− purescript -any, syb -any, transformers -any, utf8-string -any
90+ purescript -any, syb >= 0.4.1 && < 0.5, transformers -any, utf8-string -any
9191 main-is: Main.hs
9292 buildable: True
9393 hs-source-dirs: psc
@@ -97,7 +97,7 @@ executable psc
9797executable psc-make
9898 build-depends: base >=4 && <5, cmdtheline -any, containers -any,
9999 directory -any, filepath -any, mtl -any, parsec -any,
100− purescript -any, syb -any, transformers -any, utf8-string -any
100+ purescript -any, syb >= 0.4.1 && < 0.5, transformers -any, utf8-string -any
101101 main-is: Main.hs
102102 buildable: True
103103 hs-source-dirs: psc-make
@@ -107,7 +107,7 @@ executable psc-make
107107executable psci
108108 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
109109 mtl -any, parsec -any, haskeline -any, purescript -any,
110− syb -any, transformers -any, utf8-string -any, process -any,
110+ syb >= 0.4.1 && < 0.5, transformers -any, utf8-string -any, process -any,
111111 xdg-basedir -any, cmdtheline -any
112112 main-is: Main.hs
113113 buildable: True
@@ -127,7 +127,7 @@ executable docgen
127127
128128test-suite tests
129129 build-depends: base >=4 && <5, containers -any, directory -any,
130− filepath -any, mtl -any, parsec -any, purescript -any, syb -any,
130+ filepath -any, mtl -any, parsec -any, purescript -any, syb >= 0.4.1 && < 0.5,
131131 transformers -any, utf8-string -any, process -any
132132 type: exitcode-stdio-1.0
133133 main-is: Main.hs
src/Language/PureScript/Sugar/Names.hs+4−2
@@ -41,10 +41,11 @@ type ExportEnvironment = M.Map ModuleName Exports
4141-- The exported declarations from a module.
4242--
4343data Exports = Exports
44+ {
4445 -- |
4546 -- The types exported from each module
4647 --
47− { exportedTypes :: [(ProperName, [ProperName])]
48+ exportedTypes :: [(ProperName, [ProperName])]
4849 -- |
4950 -- The classes exported from each module
5051 --
@@ -59,10 +60,11 @@ data Exports = Exports
5960-- An imported environment for a particular module. This also contains the module's own members.
6061--
6162data ImportEnvironment = ImportEnvironment
63+ {
6264 -- |
6365 -- Local names for types within a module mapped to to their qualified names
6466 --
65− { importedTypes :: M.Map (Qualified ProperName) (Qualified ProperName)
67+ importedTypes :: M.Map (Qualified ProperName) (Qualified ProperName)
6668 -- |
6769 -- Local names for data constructors within a module mapped to to their qualified names
6870 --
src/Language/PureScript/Sugar/TypeClasses.hs+2−3
@@ -57,8 +57,7 @@ desugarModule (Module name decls (Just exps)) = do
5757 return $ Module name (concat declss) $ Just (exps ++ catMaybes newExpss)
5858desugarModule _ = error "Exports should have been elaborated in name desugaring"
5959
60−-- |
61−-- Desugar type class and type class instance declarations
60+{- Desugar type class and type class instance declarations
6261--
6362-- Type classes become type synonyms for their dictionaries, and type instances become dictionary declarations.
6463-- Additional values are generated to access individual members of a dictionary, with the appropriate type.
@@ -109,7 +108,7 @@ desugarModule _ = error "Exports should have been elaborated in name desugaring"
109108-- }
110109-- sub: ""
111110-- }
112−--
111+-}
113112desugarDecl :: ModuleName -> Declaration -> Desugar (Maybe DeclarationRef, [Declaration])
114113desugarDecl mn d@(TypeClassDeclaration name args implies members) = do
115114 modify (M.insert (mn, name) d)
src/Language/PureScript/TypeChecker/Monad.hs+1−1
@@ -143,7 +143,7 @@ getEnv :: (Functor m, MonadState CheckState m) => m Environment
143143getEnv = checkEnv <$> get
144144
145145-- |
146−-- Update the @Environment#
146+-- Update the @Environment@
147147--
148148putEnv :: (MonadState CheckState m) => Environment -> m ()
149149putEnv env = modify (\s -> s { checkEnv = env })
src/Language/PureScript/TypeChecker/Types.hs+2−2
@@ -888,7 +888,7 @@ check' v@(Var var) ty = do
888888 Nothing -> throwError . strMsg $ "Unable to check type subsumption"
889889 Just v'' -> return $ TypedValue True v'' ty'
890890check' (SuperClassDictionary className tys) _ = do
891− -- |
891+ {-
892892 -- Here, we replace a placeholder for a superclass dictionary with a regular
893893 -- TypeClassDictionary placeholder. The reason we do this is that it is necessary to have the
894894 -- correct super instance dictionaries in scope, and these are not available when the type class
@@ -897,7 +897,7 @@ check' (SuperClassDictionary className tys) _ = do
897897 -- Note also that the first argument to TypeClassDictionary is False, meaning we _do not_ want
898898 -- to consider superclass instances when searching for this dictionary - doing so might lead
899899 -- to traversing a cycle in the instance graph.
900− --
900+ -}
901901 dicts <- getTypeClassDictionaries
902902 return $ TypeClassDictionary False (className, tys) dicts
903903check' (TypedValue checkType val ty1) ty2 = do