on master help sign in
Fix up some code.
e245783evancz
elm/src/Gen/GenerateHtml.hs+2−1
@@ -29,7 +29,8 @@ data JSStyle = Minified | Readable
29makeScript :: JSStyle -> Either String String -> H.Html
29makeScript :: JSStyle -> Either String String -> H.Html
30makeScript _ (Left s) =
30makeScript _ (Left s) =
31 H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
31 H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
32+makeScript jsStyle (Right s) =
32−makeScript jsStyle (Right s) = H.script ! A.type_ "text/javascript" $ preEscapedToMarkup content
33+ H.script ! A.type_ "text/javascript" $ preEscapedToMarkup content
33 where content = case jsStyle of
34 where content = case jsStyle of
34 Minified -> BS.unpack . minify . BS.pack $ s
35 Minified -> BS.unpack . minify . BS.pack $ s
35 Readable -> s
36 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
2
2
3import Ast
3import Ast
4import Control.Applicative ((<$>), (<*>))
4import Control.Applicative ((<$>), (<*>))
elm/src/Types/Constrain.hs+14−12
@@ -46,19 +46,21 @@ findAmbiguous hints hints' assumptions continue =
46constrain typeHints (Module _ _ imports stmts) = do
46constrain typeHints (Module _ _ imports stmts) = do
47 (ass,css,schemess) <- unzip3 `liftM` mapM stmtGen stmts
47 (ass,css,schemess) <- unzip3 `liftM` mapM stmtGen stmts
48 hints <- typeHints
48 hints <- typeHints
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
49− let aliasHints = getAliases (imports ++ extraImports) hints
52+ aliasHints = getAliases (imports ++ extraImports) hints
50− let allHints = Map.fromList (aliasHints ++ concat schemess)
53+ allHints = Map.fromList (aliasHints ++ concat schemess)
51 assumptions <- foldM insert (unionsA ass) $ map fst (concat schemess)
54 assumptions <- foldM insert (unionsA ass) $ map fst (concat schemess)
52− findAmbiguous (map fst hints) (map fst aliasHints) assumptions $
55+ findAmbiguous (map fst hints) (map fst aliasHints) assumptions $ do
53− do let cs = let f k s vs = map (\v -> Context k $ v :<<: s) vs in
56+ let f k s vs = map (\v -> Context k $ v :<<: s) vs
54− concat . Map.elems $ Map.intersectionWithKey f allHints assumptions
57+ cs = concat . Map.elems $ Map.intersectionWithKey f allHints assumptions
55− let escapees = Map.keys $ Map.difference assumptions allHints
58+ escapees = Map.keys $ Map.difference assumptions allHints
56− return . Right . (,) escapees $ cs ++ Set.toList (Set.unions css)
59+ return . Right . (,) escapees $ cs ++ Set.toList (Set.unions css)
57− where extraImports =
60+
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)
61+gen :: Expr -> GuidCounter (Map.Map String [X],
62+ Set.Set (Context String Constraint),
63+ Type)
62
64
63gen (Var x) =
65gen (Var x) =
64 do b <- guid
66 do b <- guid