mmsyn3 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+17/−9 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- EndOfExe: endOfExecutable :: String -> IO String
+ EndOfExe: endOfExecutable :: String -> IO (Maybe String)
- EndOfExe: showE :: String -> String
+ EndOfExe: showE :: String -> Maybe String
Files
- ChangeLog.md +4/−0
- EndOfExe.hs +11/−7
- mmsyn3.cabal +2/−2
ChangeLog.md view
@@ -3,3 +3,7 @@ ## 0.1.0.0 -- YYYY-mm-dd * First version. Released on an unsuspecting world.++## 0.1.1.0 -- 2019-10-18++* First version revised A. Changed usage of errors to Maybe inside IO monad.
EndOfExe.hs view
@@ -4,19 +4,23 @@ import Data.Maybe (isJust) import System.IO.Unsafe (unsafePerformIO) --- | Function that is used instead of System.Info.os to check whether the executable ends in .exe-endOfExecutable :: String -> IO String +-- | 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+endOfExecutable :: String -> IO (Maybe String) endOfExecutable ys = do xs <- D.findExecutable ys if isJust xs - then return ""+ then return $ fmap (ys ++) (Just "") else do zs <- D.findExecutable (ys ++ ".exe") if isJust zs- then return ".exe"+ then return $ fmap (ys ++) (Just ".exe") else error ("Please, install the executable " ++ ys ++ " into the directory in the PATH variable!") -- | Function that is used to concat the endOfExecutable to the name of the program. You can use showE \"nameOfExecutable\" e. g. inside the System.Process.callCommand as the name of the executable-showE :: String -> String-showE xs | null xs = []- | otherwise = xs ++ unsafePerformIO (endOfExecutable xs)+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
mmsyn3.cabal view
@@ -2,9 +2,9 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn3-version: 0.1.0.0+version: 0.1.1.0 synopsis: A small library to deal with executable endings--- description:+description: A small library to deal with executable endings. Uses a Maybe data representation inside an IO monad. homepage: http://hackage.haskell.org/package/mmsyn3 license: MIT license-file: LICENSE