Safe Haskell | None |
---|---|
Language | Haskell98 |
- withCurrentDirectory :: (MonadIO m, MonadMask m) => FilePath -> m a -> m a
- directoryContents :: FilePath -> IO [FilePath]
- traverseDirectory :: FilePath -> IO [FilePath]
- searchPath :: (MonadIO m, MonadPlus m) => FilePath -> (FilePath -> m a) -> m a
- isParent :: FilePath -> FilePath -> Bool
- haskellSource :: FilePath -> Bool
- cabalFile :: FilePath -> Bool
- tab :: Int -> String -> String
- tabs :: Int -> String -> String
- trim :: String -> String
- split :: (a -> Bool) -> [a] -> [[a]]
- ordNub :: Ord a => [a] -> [a]
- uniqueBy :: Ord b => (a -> b) -> [a] -> [a]
- mapBy :: Ord b => (a -> b) -> [a] -> Map b a
- (.::) :: FromJSON a => HashMap Text Value -> Text -> Parser a
- (.::?) :: FromJSON a => HashMap Text Value -> Text -> Parser (Maybe a)
- (.::?!) :: FromJSON a => HashMap Text Value -> Text -> Parser [a]
- objectUnion :: Value -> Value -> Value
- jsonUnion :: (ToJSON a, ToJSON b) => a -> b -> Value
- noNulls :: [Pair] -> [Pair]
- liftException :: MonadCatch m => m a -> ExceptT String m a
- liftE :: MonadCatch m => m a -> ExceptT String m a
- liftEIO :: (MonadCatch m, MonadIO m) => IO a -> ExceptT String m a
- tries :: MonadPlus m => [m a] -> m [a]
- triesMap :: MonadPlus m => (a -> m b) -> [a] -> m [b]
- liftExceptionM :: (MonadCatch m, MonadError String m) => m a -> m a
- liftIOErrors :: MonadCatch m => ExceptT String m a -> ExceptT String m a
- eitherT :: MonadError String m => Either String a -> m a
- liftThrow :: (Show e, MonadError e m, MonadCatch m) => m a -> m a
- fromUtf8 :: ByteString -> String
- toUtf8 :: String -> ByteString
- readFileUtf8 :: FilePath -> IO String
- writeFileUtf8 :: FilePath -> String -> IO ()
- hGetLineBS :: Handle -> IO ByteString
- logException :: String -> (String -> IO ()) -> IO () -> IO ()
- logIO :: MonadCatch m => String -> (String -> m ()) -> m () -> m ()
- ignoreIO :: IO () -> IO ()
- logAsync :: (MonadIO m, MonadCatch m) => (String -> m ()) -> m () -> m ()
- liftAsync :: (MonadThrow m, MonadCatch m, MonadIO m) => IO (Async a) -> ExceptT String m a
- class FromCmd a where
- cmdJson :: String -> [Pair] -> Value
- withCmd :: String -> (Object -> Parser a) -> Value -> Parser a
- guardCmd :: String -> Object -> Parser ()
- withHelp :: Parser a -> Parser a
- cmd :: String -> String -> Parser a -> Mod CommandFields a
- parseArgs :: String -> ParserInfo a -> [String] -> Either String a
- version :: Maybe [Int]
- cutVersion :: Maybe [Int] -> Maybe [Int]
- sameVersion :: Maybe [Int] -> Maybe [Int] -> Bool
- strVersion :: Maybe [Int] -> String
- module Control.Monad.Except
- class Monad m => MonadIO m where
Documentation
withCurrentDirectory :: (MonadIO m, MonadMask m) => FilePath -> m a -> m a Source #
Run action with current directory set
traverseDirectory :: FilePath -> IO [FilePath] Source #
Collect all file names in directory recursively
searchPath :: (MonadIO m, MonadPlus m) => FilePath -> (FilePath -> m a) -> m a Source #
Search something up
haskellSource :: FilePath -> Bool Source #
Is haskell source?
String utils
Other utils
ordNub :: Ord a => [a] -> [a] Source #
nub is quadratic, https://github.com/nh2/haskell-ordnub/#ordnub
Helper
(.::) :: FromJSON a => HashMap Text Value -> Text -> Parser a Source #
Workaround, sometimes we get HM.lookup "foo" v == Nothing, but lookup "foo" (HM.toList v) == Just smth
(.::?) :: FromJSON a => HashMap Text Value -> Text -> Parser (Maybe a) Source #
Returns Nothing
when key doesn't exist or value is Null
(.::?!) :: FromJSON a => HashMap Text Value -> Text -> Parser [a] Source #
Same as .::?
for list, returns empty list for non-existant key or Null
value
Exceptions
liftException :: MonadCatch m => m a -> ExceptT String m a Source #
Lift IO exception to ExceptT
liftExceptionM :: (MonadCatch m, MonadError String m) => m a -> m a Source #
Lift IO exception to MonadError
liftIOErrors :: MonadCatch m => ExceptT String m a -> ExceptT String m a Source #
Lift IO exceptions to ExceptT
liftThrow :: (Show e, MonadError e m, MonadCatch m) => m a -> m a Source #
Throw error as exception
UTF-8
fromUtf8 :: ByteString -> String Source #
toUtf8 :: String -> ByteString Source #
IO
hGetLineBS :: Handle -> IO ByteString Source #
Async
liftAsync :: (MonadThrow m, MonadCatch m, MonadIO m) => IO (Async a) -> ExceptT String m a Source #
Command line
parseArgs :: String -> ParserInfo a -> [String] -> Either String a Source #
Parse arguments or return help
Version stuff
cutVersion :: Maybe [Int] -> Maybe [Int] Source #
Cut version to contain only significant numbers (currently 3)
Reexportss
module Control.Monad.Except
class Monad m => MonadIO m where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
MonadIO IO | |
MonadIO Ghc | |
MonadIO Hsc | |
(Applicative m, MonadIO m) => MonadIO (GhcT m) | |
MonadIO m => MonadIO (MaybeT m) | |
MonadIO m => MonadIO (ListT m) | |
MonadIO m => MonadIO (LogT m) | |
MonadIO m => MonadIO (ClientM m) # | |
MonadIO m => MonadIO (ServerM m) # | |
MonadIO m => MonadIO (UpdateM m) # | |
MonadIO m => MonadIO (IdentityT * m) | |
(Functor f, MonadIO m) => MonadIO (FreeT f m) | |
MonadIO m => MonadIO (ExceptT e m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadIO m => MonadIO (StateT s m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
MonadIO m => MonadIO (MGhcT s m) # | |
MonadIO m => MonadIO (ContT * r m) | |
MonadIO m => MonadIO (ReaderT * r m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |