packages feed

fakedata 0.6.0 → 0.6.1

raw patch · 5 files changed

+28/−3 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Faker: instance GHC.Base.Monoid a => GHC.Base.Monoid (Faker.Fake a)
+ Faker: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Faker.Fake a)

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for fakedata +## 0.6.1++* Add `Semigroup` and `Monoid` instances to `Fake`+* Doc fix: Remove broken links+ ## 0.6.0  * Fix API for "ar" locale. Add test coverage.
README.md view
@@ -13,7 +13,6 @@         -   [Generate quotes from the movie Back to the Future](#generate-quotes-from-the-movie-back-to-the-future)         -   [Combining Fake datas](#combining-fake-datas)         -   [Combinators](#combinators)-    -   [Reading Haddock Documentation](#reading-haddock-documentation)     -   [Comparision with other         libraries](#comparision-with-other-libraries)     -   [Acknowledgments](#acknowledgments)
fakedata.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 1ec2667a2aa4e02732d576c8e8b6ea03d07bb9881d9602f529963975337e1621+-- hash: 0c9b3586bf2f75d7bd593d2b98d1ff3cbde55328aff719422374b521d5fdf563  name:           fakedata-version:        0.6.0+version:        0.6.1 synopsis:       Library for producing fake data description:    Please see the README on GitHub at <https://github.com/psibi/fakedata#readme> category:       Random, Fake, FakeData
src/Faker.hs view
@@ -36,6 +36,7 @@ import Control.Monad.IO.Class import qualified Data.HashMap.Strict as HM import Data.IORef+import Data.Semigroup (Semigroup, (<>)) import Data.Text (Text) import Data.Typeable import Data.Vector (Vector)@@ -207,6 +208,15 @@ instance MonadIO Fake where   liftIO :: IO a -> Fake a   liftIO xs = Fake (\_ -> xs >>= pure)++-- | @since 0.6.1+instance Semigroup a => Semigroup (Fake a) where+  mx <> my = (<>) <$> mx <*> my++-- | @since 0.6.1+instance Monoid a => Monoid (Fake a) where+  mempty = pure mempty+  mappend mx my = mappend <$> mx <*> my  -- | Generate fake value with 'defaultFakerSettings' --
test/OtherSpec.hs view
@@ -6,6 +6,7 @@ import Control.Monad.Catch import Control.Monad.IO.Class import qualified Data.Map as M+import Data.Semigroup ((<>)) import Data.Text hiding (all, map) import qualified Data.Text as T import qualified Data.Text.IO as TIO@@ -54,3 +55,13 @@       ga <-         generateWithSettings (setDeterministic defaultFakerSettings) AP.author       ga `shouldBe` "Steuber, Donnelly and Goldner"+  describe "Semigroup instance of Fake" $+    it "can be appended and it is associative" $ do+      phraseL <- generate $ (pure "Hello " <> name) <> pure "!"+      phraseR <- generate $ pure "Hello " <> (name <> pure "!")+      phraseL `shouldBe` "Hello Dominga Stiedemann!"+      phraseR `shouldBe` "Hello Dominga Stiedemann!"+  describe "Monoid instance of Fake" $+    it "mappend mempty doesn't modify the other operand" $ do+      name' <- generate $ name `mappend` mempty+      name' `shouldBe` "Georgianne Steuber"