Merge branch 'replace-open' into dev

This commit is contained in:
Evan Czaplicki 2014-02-18 14:23:25 -05:00
commit 8aba726d22
11 changed files with 28 additions and 21 deletions

View file

@ -1,6 +1,7 @@
## next
* Change syntax for "import open List" to "import List (..)"
* Support Trampolining (thanks to Max New and Tim Hobbs)
* Drastically improved performance on markdown parsing (thanks to @Dandandan)
* Improved JSON format for types generated by elm-doc

View file

@ -169,7 +169,8 @@ betwixt a b c = do char a ; out <- c
char b <?> "closing '" ++ [b] ++ "'" ; return out
surround a z name p = do
char a ; v <- padded p
char a
v <- padded p
char z <?> unwords ["closing", name, show z]
return v

View file

@ -8,7 +8,7 @@ import Parse.Helpers
import SourceSyntax.Module (ImportMethod(..), Imports)
varList :: IParser [String]
varList = parens $ commaSep1 (var <|> parens symOp)
varList = commaSep1 (var <|> parens symOp)
getModuleName :: String -> Maybe String
getModuleName source =
@ -27,7 +27,7 @@ moduleDef = do
whitespace
names <- dotSep1 capVar <?> "name of module"
whitespace
exports <- option [] varList
exports <- option [] (parens varList)
whitespace <?> "reserved word 'where'"
reserved "where"
return (names, exports)
@ -38,17 +38,22 @@ imports = option [] ((:) <$> import' <*> many (try (freshLine >> import')))
import' :: IParser (String, ImportMethod)
import' =
do reserved "import"
whitespace
open <- optionMaybe (reserved "open")
whitespace
name <- intercalate "." <$> dotSep1 capVar
case open of
Just _ -> return (name, Hiding [])
Nothing -> let how = try (whitespace >> (as' <|> importing'))
in (,) name <$> option (As name) how
(,) name <$> option (As name) method
where
method :: IParser ImportMethod
method = try $ do whitespace
as' <|> importing'
as' :: IParser ImportMethod
as' = reserved "as" >> whitespace >> As <$> capVar <?> "alias for module"
as' = do
reserved "as"
whitespace
As <$> capVar <?> "alias for module"
importing' :: IParser ImportMethod
importing' = Importing <$> varList <?> "listing of imported values (x,y,z)"
importing' =
parens (choice [ const (Hiding []) <$> string ".."
, Importing <$> varList
] <?> "listing of imported values (x,y,z)")

View file

@ -31,8 +31,8 @@ Insert, remove, and query operations all take *O(log n)* time.
-}
import open Basics
import open Maybe
import Basics (..)
import Maybe (..)
import Native.Error
import List
import String

View file

@ -30,7 +30,7 @@ it as a single unit.
-}
import open Basics
import Basics (..)
import List
import Either (Either, Left, Right)
import Transform2D (Transform2D, identity)

View file

@ -37,12 +37,12 @@ If you need more precision, you can create custom positions.
midRightAt, topLeftAt, topRightAt, bottomLeftAt, bottomRightAt
-}
import open Basics
import Basics (..)
import Native.Utils
import JavaScript as JS
import JavaScript (JSString)
import List as List
import open Color
import Color (..)
import Maybe (Maybe, Just, Nothing)
type Properties = {

View file

@ -14,7 +14,7 @@ you have very strict latency requirements.
@docs Response
-}
import open Signal
import Signal (..)
import Native.Http
{-| The datatype for responses. Success contains only the returned message.

View file

@ -17,7 +17,7 @@ module Json where
-}
import open Basics
import Basics (..)
import Dict
import Maybe (Maybe)
import JavaScript as JS

View file

@ -25,7 +25,7 @@ list must have the same type.
@docs sort, sortBy, sortWith
-}
import open Basics
import Basics (..)
import Native.List
{-| Add an element to the front of a list `(1 :: [2,3] == [1,2,3])` -}

View file

@ -16,7 +16,7 @@ module Text where
-}
import open Basics
import Basics (..)
import Color (Color)
import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
import Maybe (Maybe)

View file

@ -14,7 +14,7 @@ module Time where
-}
import open Basics
import Basics (..)
import Native.Time
import Signal (Signal)