-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type-safe slugs for Yesod ecosystem -- -- Type-safe slugs for Yesod ecosystem. @package slug @version 0.1.3 -- | Type-safe slug implementation for Yesod ecosystem. module Web.Slug -- | Slug. Textual value inside is always guaranteed to have the following -- qualities: -- -- -- -- Slugs are good for semantic URLs and also can be used as identifier of -- a sort in some cases. data Slug -- | Create Slug from Text, all necessary transformations are -- applied. Argument of this function can be title of an article or -- something like that. -- -- Note that result is inside MonadThrow, that means you can just -- get it in Maybe, in more complex contexts it will throw -- SlugException exception using InvalidInput constructor. -- -- This function also has a useful property: -- --
--   mkSlug = mkSlug >=> mkSlug . unSlug
--   
mkSlug :: MonadThrow m => Text -> m Slug -- | Get textual representation if Slug. unSlug :: Slug -> Text -- | Convert Text into Slug only when it is already valid -- slug. -- -- This function can throw SlugException exception using -- InvalidSlug constructor. parseSlug :: MonadThrow m => Text -> m Slug -- | Ensure that given Slug is not longer than given maximum number -- of characters. If truncated slug ends in a dash, remove that dash too. -- (Dash at the end would violate properties described in documentation -- for Slug.) -- -- If the first argument is not a positive number, SlugException -- is thrown using InvalidLength constructor. truncateSlug :: MonadThrow m => Int -> Slug -> m Slug -- | This exception is thrown by mkSlug when its input cannot be -- converted into proper Slug. data SlugException -- | Slug cannot be generated for given text InvalidInput :: Text -> SlugException -- | Input is not a valid slug, see parseSlug InvalidSlug :: Text -> SlugException -- | Requested slug length is not a positive number InvalidLength :: Int -> SlugException instance GHC.Classes.Eq Web.Slug.Slug instance GHC.Show.Show Web.Slug.SlugException instance GHC.Exception.Exception Web.Slug.SlugException instance GHC.Show.Show Web.Slug.Slug instance GHC.Read.Read Web.Slug.Slug instance Data.Aeson.Types.ToJSON.ToJSON Web.Slug.Slug instance Data.Aeson.Types.FromJSON.FromJSON Web.Slug.Slug instance Database.Persist.Class.PersistField.PersistField Web.Slug.Slug instance Database.Persist.Sql.Class.PersistFieldSql Web.Slug.Slug instance Web.PathPieces.PathPiece Web.Slug.Slug