packages feed

slug 0.1.1 → 0.1.2

raw patch · 6 files changed

+21/−14 lines, 6 filesdep ~slug

Dependency ranges changed: slug

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## Slug 0.1.2++* Improved error messages in `parseJSON`.+ ## Slug 0.1.1  * Add `Read` instance of `Slug`.
LICENSE.md view
@@ -1,4 +1,4 @@-Copyright © 2015 Mark Karpov+Copyright © 2015–2016 Mark Karpov  All rights reserved. 
README.md view
@@ -3,6 +3,7 @@ [![License BSD3](https://img.shields.io/badge/license-BSD3-brightgreen.svg)](http://opensource.org/licenses/BSD-3-Clause) [![Hackage](https://img.shields.io/hackage/v/slug.svg?style=flat)](https://hackage.haskell.org/package/slug) [![Stackage Nightly](http://stackage.org/package/slug/badge/nightly)](http://stackage.org/nightly/package/slug)+[![Stackage LTS](http://stackage.org/package/slug/badge/lts)](http://stackage.org/lts/package/slug) [![Build Status](https://travis-ci.org/mrkkrp/slug.svg?branch=master)](https://travis-ci.org/mrkkrp/slug) [![Coverage Status](https://coveralls.io/repos/mrkkrp/slug/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrkkrp/slug?branch=master) @@ -53,6 +54,6 @@  ## License -Copyright © 2015 Mark Karpov+Copyright © 2015–2016 Mark Karpov  Distributed under BSD 3 clause license.
Web/Slug.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Web.Slug--- Copyright   :  © 2015 Mark Karpov+-- Copyright   :  © 2015–2016 Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>@@ -22,7 +22,7 @@ where  import Control.Exception (Exception)-import Control.Monad (mzero, (>=>), liftM)+import Control.Monad ((>=>), liftM) import Control.Monad.Catch (MonadThrow (..)) import Data.Aeson.Types (ToJSON (..), FromJSON (..)) import Data.Char (isAlphaNum)@@ -32,8 +32,8 @@ import Database.Persist.Sql (PersistFieldSql (..)) import Database.Persist.Types (SqlType (..)) import Web.PathPieces-import qualified Data.Aeson.Types as A-import qualified Data.Text as T+import qualified Data.Aeson as A+import qualified Data.Text  as T  -- | This exception is thrown by 'mkSlug' when its input cannot be converted -- into proper 'Slug'.@@ -75,7 +75,7 @@ -- in 'Maybe', in more complex contexts it will throw 'SlugException' -- exception using 'InvalidInput' constructor. ----- This function also have a useful property:+-- This function also has a useful property: -- -- > mkSlug = mkSlug >=> mkSlug . unSlug @@ -133,8 +133,10 @@   toJSON = toJSON . unSlug  instance FromJSON Slug where-  parseJSON (A.String v) = maybe mzero return (parseSlug v)-  parseJSON _            = mzero+  parseJSON = A.withText "Slug" $ \txt ->+    case parseSlug txt of+      Left err -> fail (show err)+      Right val -> return val  instance PersistField Slug where   toPersistValue   = toPersistValue . unSlug
slug.cabal view
@@ -2,7 +2,7 @@ -- -- Cabal configuration for ‘slug’. ----- Copyright © 2015 Mark Karpov+-- Copyright © 2015–2016 Mark Karpov -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are@@ -32,7 +32,7 @@ -- POSSIBILITY OF SUCH DAMAGE.  name:                 slug-version:              0.1.1+version:              0.1.2 cabal-version:        >= 1.10 license:              BSD3 license-file:         LICENSE.md@@ -40,7 +40,7 @@ maintainer:           Mark Karpov <markkarpov@opmbx.org> homepage:             https://github.com/mrkkrp/slug bug-reports:          https://github.com/mrkkrp/slug/issues-category:             Web+category:             Web, Yesod synopsis:             Type-safe slugs for Yesod ecosystem build-type:           Simple description:          Type-safe slugs for Yesod ecosystem.@@ -80,7 +80,7 @@                     , base                       >= 4.6 && < 5                     , exceptions                 >= 0.6                     , path-pieces                >= 0.1.5-                    , slug                       >= 0.1.1+                    , slug                       >= 0.1.2                     , test-framework             >= 0.6 && < 1                     , test-framework-quickcheck2 >= 0.3 && < 0.4                     , text                       >= 1.0
tests/Main.hs view
@@ -2,7 +2,7 @@ -- -- Slug tests. ----- Copyright © 2015 Mark Karpov+-- Copyright © 2015–2016 Mark Karpov -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are