on master help sign in
Fix up some code.
commite2457830c7d5a237bade0f0a4c3fb89c1cd23b15 authorevancz <info@elm-lang.org> dateSat 1 Dec 2012, 20:42 (14 years ago) parent06e5a22
3 files changed+17−14
elm/src/Gen/GenerateHtml.hs+2−1 elm/src/Parse/Expr.hs+1−1 elm/src/Types/Constrain.hs+14−12
elm/src/Gen/GenerateHtml.hs+2−1
@@ -29,7 +29,8 @@ data JSStyle = Minified | Readable
2929makeScript :: JSStyle -> Either String String -> H.Html
3030makeScript _ (Left s) =
3131 H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
32−makeScript jsStyle (Right s) = H.script ! A.type_ "text/javascript" $ preEscapedToMarkup content
32+makeScript jsStyle (Right s) =
33+ H.script ! A.type_ "text/javascript" $ preEscapedToMarkup content
3334 where content = case jsStyle of
3435 Minified -> BS.unpack . minify . BS.pack $ s
3536 Readable -> s
elm/src/Parse/Expr.hs+1−1
@@ -1,4 +1,4 @@
1−module Parse.Expr {-(def,term)-} where
1+module Parse.Expr (def,term) where
22
33import Ast
44import Control.Applicative ((<$>), (<*>))
elm/src/Types/Constrain.hs+14−12
@@ -46,19 +46,21 @@ findAmbiguous hints hints' assumptions continue =
4646constrain typeHints (Module _ _ imports stmts) = do
4747 (ass,css,schemess) <- unzip3 `liftM` mapM stmtGen stmts
4848 hints <- typeHints
49− let aliasHints = getAliases (imports ++ extraImports) hints
50− let allHints = Map.fromList (aliasHints ++ concat schemess)
49+ let extraImports = ("Time", Hiding ["read"]) : map (\n -> (n, Hiding []))
50+ ["List","Signal","Text","Graphics","Color"]
51+ insert as n = do v <- guid; return $ Map.insertWith' (\_ x -> x) n [v] as
52+ aliasHints = getAliases (imports ++ extraImports) hints
53+ allHints = Map.fromList (aliasHints ++ concat schemess)
5154 assumptions <- foldM insert (unionsA ass) $ map fst (concat schemess)
52− findAmbiguous (map fst hints) (map fst aliasHints) assumptions $
53− do let cs = let f k s vs = map (\v -> Context k $ v :<<: s) vs in
54− concat . Map.elems $ Map.intersectionWithKey f allHints assumptions
55− let escapees = Map.keys $ Map.difference assumptions allHints
56− return . Right . (,) escapees $ cs ++ Set.toList (Set.unions css)
57− where extraImports =
58− map (\n -> (n, Hiding [])) ["List","Signal","Text","Graphics","Color"]
59− insert as n = do v <- guid; return $ Map.insertWith' (\_ x -> x) n [v] as
60−
61−gen :: Expr -> GuidCounter (Map.Map String [X], Set.Set (Context String Constraint), Type)
55+ findAmbiguous (map fst hints) (map fst aliasHints) assumptions $ do
56+ let f k s vs = map (\v -> Context k $ v :<<: s) vs
57+ cs = concat . Map.elems $ Map.intersectionWithKey f allHints assumptions
58+ escapees = Map.keys $ Map.difference assumptions allHints
59+ return . Right . (,) escapees $ cs ++ Set.toList (Set.unions css)
60+
61+gen :: Expr -> GuidCounter (Map.Map String [X],
62+ Set.Set (Context String Constraint),
63+ Type)
6264
6365gen (Var x) =
6466 do b <- guid