on master help sign in
Get rid of Build.Artifact, elm-make is in charge of writing to disk
commita4e8dc5186ae59f528bbe359223b01eeda75dabe authorEvan Czaplicki <info@elm-lang.org> dateFri 17 Oct 2014, 17:47 (12 years ago) parentb5fde06
2 files changed−33
elm-compiler.cabal−2 src/Build/Artifact.hs−31
elm-compiler.cabal−2
@@ -97,7 +97,6 @@ Library
9797 Type.State,
9898 Type.Type,
9999 Type.Unify,
100− Build.Artifact,
101100 Build.Flags,
102101 Build.Print,
103102 Build.Source,
@@ -195,7 +194,6 @@ Executable elm-compiler
195194 Type.State,
196195 Type.Type,
197196 Type.Unify,
198− Build.Artifact,
199197 Build.Flags,
200198 Build.Print,
201199 Build.Source,
src/Build/Artifact.hsdeleted−31
@@ -1,31 +0,0 @@
1−{-# OPTIONS_GHC -W #-}
2−{-# LANGUAGE FlexibleContexts #-}
3−module Build.Artifact (read) where
4−
5−import Prelude hiding (read)
6−import Control.Monad.Error (MonadError, throwError, MonadIO, liftIO)
7−import qualified Data.ByteString.Lazy as LBS
8−import qualified Data.Binary as Binary
9−import System.Directory (doesFileExist)
10−
11−
12−read :: (MonadIO m, MonadError String m, Binary.Binary a) => FilePath -> m a
13−read filePath =
14− do exists <- liftIO (doesFileExist filePath)
15− if exists then decode else throwError notFound
16− where
17− decode =
18− do bytes <- liftIO (LBS.readFile filePath)
19− case Binary.decodeOrFail bytes of
20− Right (_, _, binaryInfo) -> return binaryInfo
21− Left (_, _, _) -> throwError corrupted
22−
23− corrupted =
24− concat
25− [ "Error reading build artifact ", filePath, "\n"
26− , " The file was generated by a previous build and may be outdated or corrupt.\n"
27− , " Please remove the file and try again."
28− ]
29−
30− notFound =
31− "Unable to find file " ++ filePath ++ " for deserialization!"