elm-make 0.1 → 0.1.1
raw patch · 4 files changed
+21/−9 lines, 4 filesdep ~elm-compiler
Dependency ranges changed: elm-compiler
Files
- LICENSE +1/−1
- elm-make.cabal +2/−2
- src/Arguments.hs +1/−1
- src/LoadInterfaces.hs +17/−5
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014, Evan Czaplicki+Copyright (c) 2014-2015, Evan Czaplicki All rights reserved.
elm-make.cabal view
@@ -1,5 +1,5 @@ Name: elm-make-Version: 0.1+Version: 0.1.1 Synopsis: A build tool for Elm projects@@ -62,7 +62,7 @@ bytestring, containers >= 0.3, directory,- elm-compiler >= 0.13,+ elm-compiler >= 0.14.1 && < 0.15, elm-package, filepath, mtl,
src/Arguments.hs view
@@ -67,7 +67,7 @@ moreHelp = linesToDoc [ "To learn more about a particular command run:"- , " elm-package COMMAND --help"+ , " elm-make COMMAND --help" ]
src/LoadInterfaces.hs view
@@ -41,6 +41,11 @@ return (Map.fromList enhancedData) +-- TODO: if two modules in the same package have the same name, their interface+-- files will be indistinguishable right now. The most common case of this is+-- modules named Main. As a stopgap, we never load in the interface file for+-- Main. The real fix may be to add a hash of the source code to the interface+-- files. maybeLoadInterface :: (MonadIO m, MonadReader FilePath m, MonadError String m) => (ModuleID, ProjectData Location)@@ -52,7 +57,7 @@ fresh <- liftIO (isFresh sourcePath interfacePath) maybeInterface <-- case fresh of+ case fresh && not (isMain moduleID) of False -> return Nothing True -> do interface <- File.readBinary interfacePath@@ -72,6 +77,13 @@ return (sourceTime <= interfaceTime) +isMain :: ModuleID -> Bool+isMain (ModuleID (Module.Name names) _) =+ case names of+ ["Main"] -> True+ _ -> False++ -- FILTER STALE INTERFACES -- have files become stale due to other changes? filterStaleInterfaces@@ -97,14 +109,14 @@ trueLocation = case maybeInterface of Just interface- | all (haveInterface enhancedSummary) deps ->+ | all (haveInterface filteredSummary) deps -> Right interface _ -> Left filePath haveInterface- :: Map.Map ModuleID (ProjectData (Location, Maybe Module.Interface))+ :: Map.Map ModuleID (ProjectData (Either Location Module.Interface)) -> ModuleID -> Bool haveInterface enhancedSummary rawName =@@ -112,7 +124,7 @@ Nothing -> True Just name -> case Map.lookup name enhancedSummary of- Just (ProjectData (_, Just _) _) -> True+ Just (ProjectData (Right _) _) -> True _ -> False @@ -190,7 +202,7 @@ Graph.AcyclicSCC name -> return name Graph.CyclicSCC cycle@(first:_) -> throwError $- "Your dependencies for a cycle:\n\n"+ "Your dependencies form a cycle:\n\n" ++ showCycle first cycle ++ "\nYou may need to move some values to a new module to get rid of the cycle."