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