mmsyn3 0.1.4.0 → 0.1.5.0
raw patch · 4 files changed
+37/−24 lines, 4 filesdep ~basedep ~directoryPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, directory
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- EndOfExe.hs +29/−21
- LICENSE +1/−1
- mmsyn3.cabal +2/−2
ChangeLog.md view
@@ -31,3 +31,8 @@ ## 0.1.4.0 -- 2019-12-24 * First version revised G. Changed the bounds for the dependency so that it can now be compiled for GHC 8.8.1.++## 0.1.5.0 -- 2020-05-14++* First version revised H. Changed the bounds for the dependency so that it can now be compiled for GHC 8.10* series. Some code and documentation +improvements.
EndOfExe.hs view
@@ -1,34 +1,42 @@+-- |+-- Module : EndOfExe+-- Copyright : (c) OleksandrZhabenko 2019-2020+-- License : MIT+-- Maintainer : olexandr543@yahoo.com+--+-- A small library to deal with executable endings. Uses a Maybe data representation inside an IO monad.+ module EndOfExe where import qualified System.Directory as D (findExecutable) import Data.Maybe (isJust,isNothing) import System.IO.Unsafe (unsafePerformIO) --- | Function that is used instead of 'System.Info.os' to check whether the executable ends in .exe. The function returns @IO Nothing@ if there is neither @ys@ nor @(ys ++ ".exe")@ names for executables in the --- variable @PATH@+-- | Can be used instead of 'System.Info.os' to check whether the executable ends in \".exe\". The function returns 'IO' 'Nothing' if there is neither +-- @ys@ nor @(ys ++ ".exe")@ names for executables in the variable @PATH@. endOfExecutable :: String -> IO (Maybe String) endOfExecutable ys = do- xs <- D.findExecutable ys- if isJust xs - then return $ fmap (ys ++) (Just "")- else do- zs <- D.findExecutable (ys ++ ".exe")- if isJust zs- then return $ fmap (ys ++) (Just ".exe")- else error ("Please, install the executable " ++ ys ++ " into the directory in the PATH variable!")+ xs <- D.findExecutable ys+ if isJust xs + then return $ fmap (ys ++) (Just "")+ else do+ zs <- D.findExecutable (ys ++ ".exe")+ if isJust zs+ then return $ fmap (ys ++) (Just ".exe")+ else error ("Please, install the executable " ++ ys ++ " into the directory in the PATH variable!") --- | Function to get the proper name of the executable in the system (it must be seen in the directories in the @PATH@ variable). --- You can use 'showE' \"nameOfExecutable\" to get @Just \"nameOfExecutable\"@ if it is present on the system. Further you can adopt it to be used +-- | Gets the proper name of the executable in the system (it must be seen in the directories in the @PATH@ variable). +-- You can use 'showE' \"nameOfExecutable\" to get 'Just' \"nameOfExecutable\"@ if it is present on the system. Further you can adopt it to be used -- inside the 'System.Process.callCommand' as the name of the executable showE :: String -> Maybe String-showE xs | null xs = error "No executable specified!"- | otherwise = let r = unsafePerformIO . endOfExecutable $ xs in - if isJust r- then r- else Nothing+showE xs + | null xs = error "No executable specified!"+ | otherwise = unsafePerformIO . endOfExecutable $ xs --- | Function that being given a list of names of executables (without .exe suffix) looks up for them in the specified list order till the first existing occurrence.--- If there is no such occurrence (the specified executables are not installed in the directories mentioned in the variable @PATH@) then the function returns @Nothing@.+-- | Being given a list of names of executables (without an \".exe\" suffix) looks up for them in the specified list order +-- till the first existing occurrence. If there is no such occurrence (the specified executables are not installed in the directories +-- mentioned in the variable @PATH@) then the function returns 'Nothing'. findSysExes :: [String] -> Maybe String-findSysExes xss | null (dropWhile isNothing . map showE $ xss) = Nothing- | otherwise = head (dropWhile isNothing . map showE $ xss)+findSysExes xss + | all (isNothing . showE) xss = Nothing+ | otherwise = Just (head . dropWhile (isNothing . showE) $ xss)
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2019 OleksandrZhabenko+Copyright (c) 2019-2020 OleksandrZhabenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
mmsyn3.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn3-version: 0.1.4.0+version: 0.1.5.0 synopsis: A small library to deal with executable endings description: A small library to deal with executable endings. Uses a Maybe data representation inside an IO monad. homepage: https://hackage.haskell.org/package/mmsyn3@@ -20,6 +20,6 @@ exposed-modules: EndOfExe -- other-modules: -- other-extensions:- build-depends: base >=4.7 && <4.14, directory >=1 && <1.4+ build-depends: base >=4.7 && <4.15, directory >=1 && <1.5 -- hs-source-dirs: default-language: Haskell2010