packages feed

eros 0.4.0.1 → 0.4.1.0

raw patch · 3 files changed

+27/−17 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -18,9 +18,9 @@ successfully building the documentation, so I also publish the documentation on [GitHub pages](https://pharpend.github.io/eros-haddock) -# Usage - v.0.4.0.1+# Usage - v.0.4.1.0 -This is a usage guide for version 0.4.0.1. There will be more up-to-date usage+This is a usage guide for version 0.4.1.0. There will be more up-to-date usage guides as more versions come, hopefully.  To install, add `eros >=0.4 && <0.5` to the `build-depends` field in your
eros.cabal view
@@ -1,5 +1,5 @@ name:                eros-version:             0.4.0.1+version:             0.4.1.0 synopsis:            A text censorship library. description:   A Haskell library for censoring text, using
src/Text/Eros/Phraselist.hs view
@@ -50,6 +50,26 @@ import           System.Exit import           Text.Eros.Phrase +-- |Read a 'Phraselist', marshal it into a 'PhraseForest'.+readPhraselist :: Phraselist t => t -> IO PhraseForest+readPhraselist elist = do+  lpath <- phraselistPath elist+  ltext <- B.readFile lpath+  let ljson = (eitherDecode ltext) :: Either String [PAT]+  case ljson of+    Left msg   -> fail msg+    Right pats -> return $ map fromPAT pats++-- |Load a 'Phraselist' directly into a 'PhraseMap'+readPhraseMap :: Phraselist t => t -> IO PhraseMap+readPhraseMap plist = fmap mkMap $ readPhraselist plist++-- |Read the phraselist from disk+servePhraselist :: Phraselist t => t -> IO B.ByteString+servePhraselist plist = B.readFile =<< phraselistPath plist++-- This is the type for a Phraselist - it just needs to be provided+-- with a filepath. class Phraselist t where   phraselistPath :: t -> IO FilePath @@ -92,6 +112,10 @@               | Weapons               | Webmail +------------------------------------+-- Okay, this is the boring stuff --+------------------------------------+ instance Eq ErosList where   (==) Chat Chat = True   (==) Conspiracy Conspiracy = True@@ -291,16 +315,6 @@ fromPhraseAlmostTree :: PAT -> PhraseTree fromPhraseAlmostTree = fromPAT --- |Read a 'Phraselist', marshal it into a 'PhraseForest'.-readPhraselist :: Phraselist t => t -> IO PhraseForest-readPhraselist elist = do-  lpath <- phraselistPath elist-  ltext <- B.readFile lpath-  let ljson = (eitherDecode ltext) :: Either String [PAT]-  case ljson of-    Left msg   -> fail msg-    Right pats -> return $ map fromPAT pats- -- |Alias for 'readPhraselist' loadPhraselist :: Phraselist t => t -> IO PhraseForest loadPhraselist = readPhraselist@@ -320,10 +334,6 @@ -- |Alias for 'readPhraselist' loadPhraseForest :: Phraselist t => t -> IO PhraseForest loadPhraseForest = readPhraselist---- |Load a 'Phraselist' directly into a 'PhraseMap'-readPhraseMap :: Phraselist t => t -> IO PhraseMap-readPhraseMap plist = fmap mkMap $ readPhraselist plist  -- |Alias for 'readPhraseMap' loadPhraseMap :: Phraselist t => t -> IO PhraseMap