purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.Make.Monad

Contents

- Implementation of Make API using files on disk

Synopsis

- newtype Make a = Make {
  - unMake :: ReaderT Options (ExceptT MultipleErrors (Logger MultipleErrors)) a
  }
- runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors)
- makeIO :: (MonadIO m, MonadError MultipleErrors m) => Text -> IO a -> m a
- getTimestamp :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m UTCTime
- getTimestampMaybe :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe UTCTime)
- readTextFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m Text
- readJSONFile :: (MonadIO m, MonadError MultipleErrors m, FromJSON a) => FilePath -> m (Maybe a)
- readJSONFileIO :: FromJSON a => FilePath -> IO (Maybe a)
- readCborFile :: (MonadIO m, MonadError MultipleErrors m, Serialise a) => FilePath -> m (Maybe a)
- readCborFileIO :: Serialise a => FilePath -> IO (Maybe a)
- readExternsFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe ExternsFile)
- hashFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m ContentHash
- writeTextFile :: FilePath -> ByteString -> Make ()
- writeJSONFile :: (MonadIO m, MonadError MultipleErrors m, ToJSON a) => FilePath -> a -> m ()
- writeCborFile :: (MonadIO m, MonadError MultipleErrors m, Serialise a) => FilePath -> a -> m ()
- writeCborFileIO :: Serialise a => FilePath -> a -> IO ()
- copyFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> FilePath -> m ()

# Implementation of Make API using files on disk

newtype Make a #

A monad for running make actions

Constructors

Make |
Fields unMake :: ReaderT Options (ExceptT MultipleErrors (Logger MultipleErrors)) a

#### Instances

Instances details

MonadIO Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods liftIO :: IO a -> Make a #
Applicative Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods pure :: a -> Make a # (<*>) :: Make (a -> b) -> Make a -> Make b # liftA2 :: (a -> b -> c) -> Make a -> Make b -> Make c # (*>) :: Make a -> Make b -> Make b # (<*) :: Make a -> Make b -> Make a #
Functor Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods fmap :: (a -> b) -> Make a -> Make b # (<$) :: a -> Make b -> Make a #
Monad Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods (>>=) :: Make a -> (a -> Make b) -> Make b # (>>) :: Make a -> Make b -> Make b # return :: a -> Make a #
MonadBaseControl IO Make # |
Instance details Defined in Language.PureScript.Make.Monad Associated Types
type StM Make a |
Instance details Defined in Language.PureScript.Make.Monad type StM Make a = Either MultipleErrors a
Methods liftBaseWith :: (RunInBase Make IO -> IO a) -> Make a # restoreM :: StM Make a -> Make a #
MonadError MultipleErrors Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods throwError :: MultipleErrors -> Make a # catchError :: Make a -> (MultipleErrors -> Make a) -> Make a #
MonadReader Options Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods ask :: Make Options # local :: (Options -> Options) -> Make a -> Make a # reader :: (Options -> a) -> Make a #
MonadWriter MultipleErrors Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods writer :: (a, MultipleErrors) -> Make a # tell :: MultipleErrors -> Make () # listen :: Make a -> Make (a, MultipleErrors) # pass :: Make (a, MultipleErrors -> MultipleErrors) -> Make a #
MonadBase IO Make # |
Instance details Defined in Language.PureScript.Make.Monad Methods liftBase :: IO α -> Make α #
type StM Make a # |
Instance details Defined in Language.PureScript.Make.Monad type StM Make a = Either MultipleErrors a

runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors) #

Execute a `Make` monad, returning either errors, or the result of the compile plus any warnings.

makeIO :: (MonadIO m, MonadError MultipleErrors m) => Text -> IO a -> m a #

Run an `IO` action in the `Make` monad. The `String` argument should describe what we were trying to do; it is used for rendering errors in the case that an IOException is thrown.

getTimestamp :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m UTCTime #

Get a file's modification time in the `Make` monad, capturing any errors using the `MonadError` instance.

getTimestampMaybe :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe UTCTime) #

Get a file's modification time in the `Make` monad, returning Nothing if the file does not exist.

readTextFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m Text #

Read a text file strictly in the `Make` monad, capturing any errors using the `MonadError` instance.

readJSONFile :: (MonadIO m, MonadError MultipleErrors m, FromJSON a) => FilePath -> m (Maybe a) #

Read a JSON file in the `Make` monad, returning `Nothing` if the file does not exist or could not be parsed. Errors are captured using the `MonadError` instance.

readJSONFileIO :: FromJSON a => FilePath -> IO (Maybe a) #

readCborFile :: (MonadIO m, MonadError MultipleErrors m, Serialise a) => FilePath -> m (Maybe a) #

Read a Cbor encoded file in the `Make` monad, returning `Nothing` if the file does not exist or could not be parsed. Errors are captured using the `MonadError` instance.

readCborFileIO :: Serialise a => FilePath -> IO (Maybe a) #

readExternsFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe ExternsFile) #

Read an externs file, returning `Nothing` if the file does not exist, could not be parsed, or was generated by a different version of the compiler.

hashFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m ContentHash #

writeTextFile :: FilePath -> ByteString -> Make () #

Write a text file in the `Make` monad, capturing any errors using the `MonadError` instance.

writeJSONFile :: (MonadIO m, MonadError MultipleErrors m, ToJSON a) => FilePath -> a -> m () #

Write a JSON file in the `Make` monad, capturing any errors using the `MonadError` instance.

writeCborFile :: (MonadIO m, MonadError MultipleErrors m, Serialise a) => FilePath -> a -> m () #

writeCborFileIO :: Serialise a => FilePath -> a -> IO () #

copyFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> FilePath -> m () #

Copy a file in the `Make` monad, capturing any errors using the `MonadError` instance.