on master help sign in
Merge branch 'replace-open' into dev
8aba726Evan Czaplicki
changelog.txt+1
@@ -1,6 +1,7 @@
1
1
2## next
2## next
3
3
4+ * Change syntax for "import open List" to "import List (..)"
4 * Support Trampolining (thanks to Max New and Tim Hobbs)
5 * Support Trampolining (thanks to Max New and Tim Hobbs)
5 * Drastically improved performance on markdown parsing (thanks to @Dandandan)
6 * Drastically improved performance on markdown parsing (thanks to @Dandandan)
6 * Improved JSON format for types generated by elm-doc
7 * Improved JSON format for types generated by elm-doc
compiler/Parse/Helpers.hs+2−1
@@ -169,7 +169,8 @@ betwixt a b c = do char a ; out <- c
169 char b <?> "closing '" ++ [b] ++ "'" ; return out
169 char b <?> "closing '" ++ [b] ++ "'" ; return out
170
170
171surround a z name p = do
171surround a z name p = do
172+ char a
172− char a ; v <- padded p
173+ v <- padded p
173 char z <?> unwords ["closing", name, show z]
174 char z <?> unwords ["closing", name, show z]
174 return v
175 return v
175
176
compiler/Parse/Module.hs+15−10
@@ -8,7 +8,7 @@ import Parse.Helpers
8import SourceSyntax.Module (ImportMethod(..), Imports)
8import SourceSyntax.Module (ImportMethod(..), Imports)
9
9
10varList :: IParser [String]
10varList :: IParser [String]
11−varList = parens $ commaSep1 (var <|> parens symOp)
11+varList = commaSep1 (var <|> parens symOp)
12
12
13getModuleName :: String -> Maybe String
13getModuleName :: String -> Maybe String
14getModuleName source =
14getModuleName source =
@@ -27,7 +27,7 @@ moduleDef = do
27 whitespace
27 whitespace
28 names <- dotSep1 capVar <?> "name of module"
28 names <- dotSep1 capVar <?> "name of module"
29 whitespace
29 whitespace
30− exports <- option [] varList
30+ exports <- option [] (parens varList)
31 whitespace <?> "reserved word 'where'"
31 whitespace <?> "reserved word 'where'"
32 reserved "where"
32 reserved "where"
33 return (names, exports)
33 return (names, exports)
@@ -38,17 +38,22 @@ imports = option [] ((:) <$> import' <*> many (try (freshLine >> import')))
38import' :: IParser (String, ImportMethod)
38import' :: IParser (String, ImportMethod)
39import' =
39import' =
40 do reserved "import"
40 do reserved "import"
41− whitespace
42− open <- optionMaybe (reserved "open")
43 whitespace
41 whitespace
44 name <- intercalate "." <$> dotSep1 capVar
42 name <- intercalate "." <$> dotSep1 capVar
45− case open of
46− Just _ -> return (name, Hiding [])
47− Nothing -> let how = try (whitespace >> (as' <|> importing'))
48− in (,) name <$> option (As name) how
43+ (,) name <$> option (As name) method
49 where
44 where
45+ method :: IParser ImportMethod
46+ method = try $ do whitespace
47+ as' <|> importing'
48+
50 as' :: IParser ImportMethod
49 as' :: IParser ImportMethod
50+ as' = do
51+ reserved "as"
52+ whitespace
51− as' = reserved "as" >> whitespace >> As <$> capVar <?> "alias for module"
53+ As <$> capVar <?> "alias for module"
52
54
53 importing' :: IParser ImportMethod
55 importing' :: IParser ImportMethod
56+ importing' =
57+ parens (choice [ const (Hiding []) <$> string ".."
58+ , Importing <$> varList
54− importing' = Importing <$> varList <?> "listing of imported values (x,y,z)"
59+ ] <?> "listing of imported values (x,y,z)")
libraries/Dict.elm+2−2
@@ -31,8 +31,8 @@ Insert, remove, and query operations all take *O(log n)* time.
31-}
31-}
32
32
33
33
34−import open Basics
34+import Basics (..)
35−import open Maybe
35+import Maybe (..)
36import Native.Error
36import Native.Error
37import List
37import List
38import String
38import String
libraries/Graphics/Collage.elm+1−1
@@ -30,7 +30,7 @@ it as a single unit.
30
30
31-}
31-}
32
32
33−import open Basics
33+import Basics (..)
34import List
34import List
35import Either (Either, Left, Right)
35import Either (Either, Left, Right)
36import Transform2D (Transform2D, identity)
36import Transform2D (Transform2D, identity)
libraries/Graphics/Element.elm+2−2
@@ -37,12 +37,12 @@ If you need more precision, you can create custom positions.
37 midRightAt, topLeftAt, topRightAt, bottomLeftAt, bottomRightAt
37 midRightAt, topLeftAt, topRightAt, bottomLeftAt, bottomRightAt
38-}
38-}
39
39
40−import open Basics
40+import Basics (..)
41import Native.Utils
41import Native.Utils
42import JavaScript as JS
42import JavaScript as JS
43import JavaScript (JSString)
43import JavaScript (JSString)
44import List as List
44import List as List
45−import open Color
45+import Color (..)
46import Maybe (Maybe, Just, Nothing)
46import Maybe (Maybe, Just, Nothing)
47
47
48type Properties = {
48type Properties = {
libraries/Http.elm+1−1
@@ -14,7 +14,7 @@ you have very strict latency requirements.
14@docs Response
14@docs Response
15-}
15-}
16
16
17−import open Signal
17+import Signal (..)
18import Native.Http
18import Native.Http
19
19
20{-| The datatype for responses. Success contains only the returned message.
20{-| The datatype for responses. Success contains only the returned message.
libraries/Json.elm+1−1
@@ -17,7 +17,7 @@ module Json where
17
17
18-}
18-}
19
19
20−import open Basics
20+import Basics (..)
21import Dict
21import Dict
22import Maybe (Maybe)
22import Maybe (Maybe)
23import JavaScript as JS
23import JavaScript as JS
libraries/List.elm+1−1
@@ -25,7 +25,7 @@ list must have the same type.
25@docs sort, sortBy, sortWith
25@docs sort, sortBy, sortWith
26-}
26-}
27
27
28−import open Basics
28+import Basics (..)
29import Native.List
29import Native.List
30
30
31{-| Add an element to the front of a list `(1 :: [2,3] == [1,2,3])` -}
31{-| Add an element to the front of a list `(1 :: [2,3] == [1,2,3])` -}
libraries/Text.elm+1−1
@@ -16,7 +16,7 @@ module Text where
16
16
17-}
17-}
18
18
19−import open Basics
19+import Basics (..)
20import Color (Color)
20import Color (Color)
21import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
21import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
22import Maybe (Maybe)
22import Maybe (Maybe)
libraries/Time.elm+1−1
@@ -14,7 +14,7 @@ module Time where
14
14
15-}
15-}
16
16
17−import open Basics
17+import Basics (..)
18import Native.Time
18import Native.Time
19import Signal (Signal)
19import Signal (Signal)
20
20