string-interpreter 0.3.0.0 → 0.4.0.0
raw patch · 3 files changed
+15/−1 lines, 3 files
Files
- ChangeLog.md +5/−0
- Interpreter/StringConversion.hs +9/−0
- string-interpreter.cabal +1/−1
ChangeLog.md view
@@ -12,3 +12,8 @@ * Third version. Added the possibility to specify dividing using negative second part that is counting from the end of the word in the opposite direction.++## 0.4.0.0 -- 2021-09-03++* Fourth version. Added a new function readFileIfAny that catches all IOException's so that returns empty String.+Some documentation improvements.
Interpreter/StringConversion.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE ScopedTypeVariables #-} -- | -- Module : Interpreter.StringConversion@@ -16,7 +17,9 @@ import Data.Char (isDigit) import Data.List (sort,nub,(\\)) import Data.Monoid (mappend)+import Control.Exception +{-| Converts the second given string into the form that can be easily used by the phonetic-languages-simplified-* implementations. -} convStringInterpreter :: String -> String -> String convStringInterpreter contrs xs | null contrs = xs@@ -50,3 +53,9 @@ wordsN = map (\i -> tss !! (i - 1)) idxs restWords = tss \\ wordsN in unwords restWords `mappend` " " `mappend` concat wordsN++{-| Inspired by: 'https://hackage.haskell.org/package/base-4.15.0.0/docs/src/GHC-IO.html#catch'+Reads a textual file given by its 'FilePath' and returns its contents lazily. If there is+some 'IOException' thrown or an empty file then returns just "". Raises an exception for the binary file. -}+readFileIfAny :: FilePath -> IO String+readFileIfAny file = catch (readFile file) (\(e :: IOException) -> return "")
string-interpreter.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: string-interpreter-version: 0.3.0.0+version: 0.4.0.0 synopsis: Is used in the recursive mode for phonetic languages approach. description: A library that has commonly used function for the phonetic-languages implementations. homepage: https://hackage.haskell.org/package/string-interpreter