on master help sign in
Clean up imports in many files.
ce64672evancz
compiler/Compiler.hs+1−1
@@ -14,7 +14,7 @@ import qualified Text.Jasmine as JS
14import qualified Data.ByteString.Lazy.Char8 as BS
14import qualified Data.ByteString.Lazy.Char8 as BS
15
15
16import Ast
16import Ast
17−import Initialize
17+import Initialize (build,buildFromSource)
18import CompileToJS
18import CompileToJS
19import GenerateHtml
19import GenerateHtml
20import qualified Libraries as Libraries
20import qualified Libraries as Libraries
compiler/Initialize.hs+1−1
@@ -13,7 +13,7 @@ import Rename
13import qualified Libraries as Libs
13import qualified Libraries as Libs
14import Types.Types ((-:))
14import Types.Types ((-:))
15import Types.Hints (hints)
15import Types.Hints (hints)
16−import Types.Unify
16+import Types.Unify (unify)
17import Types.Alias (dealias, mistakes)
17import Types.Alias (dealias, mistakes)
18import Optimize
18import Optimize
19import CompileToJS (jsModule)
19import CompileToJS (jsModule)
compiler/Language/Elm/Quasi.hs+9−6
@@ -4,11 +4,13 @@
4{-# LANGUAGE CPP #-}
4{-# LANGUAGE CPP #-}
5{-# OPTIONS_GHC -fno-warn-missing-fields #-}
5{-# OPTIONS_GHC -fno-warn-missing-fields #-}
6
6
7−-- | This module contains Shakespearean (see "Text.Shakespeare") templates for Elm.
7+-- | This module contains Shakespearean (see "Text.Shakespeare") templates
8−-- It introduces type-safe compile-time variable and URL interpolation. A typeclass
8+-- for Elm. It introduces type-safe compile-time variable and URL
9−-- @'ToElm'@ is provided for interpolated variables.
9+-- interpolation. A typeclass @'ToElm'@ is provided for interpolated
10+-- variables.
10--
11--
11−-- Further reading on Shakespearean templates: <http://www.yesodweb.com/book/templates>
12+-- Further reading on Shakespearean templates:
13+-- <http://www.yesodweb.com/book/templates>
12--
14--
13-- Further reading on Elm: <http://elm-lang.org>
15-- Further reading on Elm: <http://elm-lang.org>
14module Language.Elm.Quasi
16module Language.Elm.Quasi
@@ -17,8 +19,9 @@ module Language.Elm.Quasi
17 -- |These QuasiQuoters return functions of the type @(t -> 'Elm')@
19 -- |These QuasiQuoters return functions of the type @(t -> 'Elm')@
18 -- where @t@ is the URL rendering function if type-safe URLs are used.
20 -- where @t@ is the URL rendering function if type-safe URLs are used.
19 --
21 --
20− -- A usage example for both type-safe (Yesod) and standard path segment (Happstack)
22+ -- A usage example for both type-safe (Yesod) and standard path segment
21− -- URLs is provided in the Examples folder in the Git repository.
23+ -- (Happstack) URLs is provided in the Examples folder in the Git
24+ -- repository.
22 elm
25 elm
23 , elmFile
26 , elmFile
24 , elmFileReload
27 , elmFileReload
compiler/Types/Hints.hs+15−14
@@ -13,19 +13,20 @@ import Types.Types
13
13
14hints :: GuidCounter [(String, Scheme)]
14hints :: GuidCounter [(String, Scheme)]
15hints = liftM catMaybes (mapM toScheme values)
15hints = liftM catMaybes (mapM toScheme values)
16− where
16+ where
17− values :: [(String, String)]
17+ values :: [(String, String)]
18− values = addPrefixes (Map.toList (Map.map Map.toList Libs.libraries))
18+ values = addPrefixes (Map.toList (Map.map Map.toList Libs.libraries))
19
19
20− addPrefixes :: [(String,[(String, String)])] -> [(String, String)]
20+ addPrefixes :: [(String,[(String, String)])] -> [(String, String)]
21− addPrefixes = concatMap (\(m,vs) -> map (first (\n -> m ++ "." ++ n)) vs)
21+ addPrefixes = concatMap (\(m,vs) -> map (first (\n -> m ++ "." ++ n)) vs)
22
22
23− toScheme :: (String, String) -> GuidCounter (Maybe (String, Scheme))
23+ toScheme :: (String, String) -> GuidCounter (Maybe (String, Scheme))
24− toScheme (name, 't':'y':'p':'e':' ':_) = return Nothing
24+ toScheme (name, 't':'y':'p':'e':' ':_) = return Nothing
25− toScheme (name, 'd':'a':'t':'a':' ':_) = return Nothing
25+ toScheme (name, 'd':'a':'t':'a':' ':_) = return Nothing
26− toScheme (name, tipeString) =
26+ toScheme (name, tipeString) =
27− let err = "compiler error parsing type of " ++ name ++ ":\n" ++ tipeString in
27+ let err = "compiler error parsing type of " ++ name ++ ":\n" ++ tipeString
28− case iParse (fmap toType typeExpr) err tipeString of
28+ in case iParse (fmap toType typeExpr) err tipeString of
29− Left err -> error (show err)
29+ Left err -> error (show err)
30+ Right tipe -> do
30− Right tipe -> do scheme <- Subs.generalize [] =<< Subs.superize name tipe
31+ scheme <- Subs.generalize [] =<< Subs.superize name tipe
31− return (Just (name, scheme))
32+ return (Just (name, scheme))
compiler/Types/Solver.hs−1
@@ -11,7 +11,6 @@ import qualified Data.Set as Set
11import qualified Data.Map as Map
11import qualified Data.Map as Map
12import Guid
12import Guid
13import Types.Types
13import Types.Types
14−import Types.Constrain
15import Types.Substitutions
14import Types.Substitutions
16import Types.Alias (dealias)
15import Types.Alias (dealias)
17
16
compiler/Types/Unify.hs+5−5
@@ -6,11 +6,11 @@ import qualified Data.Map as Map
6
6
7import Ast
7import Ast
8import Guid
8import Guid
9−import Types.Constrain
9+import qualified Types.Constrain as Constrain
10−import Types.Solver
10+import qualified Types.Solver as Solver
11−import Types.Alias as Alias
11+import qualified Types.Alias as Alias
12
12
13unify hints modul@(Module _ _ _ stmts) = run $ do
13unify hints modul@(Module _ _ _ stmts) = run $ do
14− constraints <- constrain hints modul
14+ constraints <- Constrain.constrain hints modul
15− either (return . Left) (solver (Alias.get stmts) Map.empty) constraints
15+ either (return . Left) (Solver.solver (Alias.get stmts) Map.empty) constraints
16
16