realworld-hs-0.1.0.0: Scotty impl of https://github.com/gothinkster/realworld
Safe HaskellSafe-Inferred
LanguageGHC2021

Conduit.Features.Articles.Slugs

Synopsis

Documentation

extractIDFromSlug :: Slug -> Either ArticleError ArticleID Source #

Attempts to extract the ID from a Slug, where the slug is "articleID-slugifiedTitle".

The reason it's an opaque-er newtype rather than a proper invarient is just because Slugs are allowed to be created without proper validation, with it rather being deferred to this function instead.

mkNoIDSlug :: Text -> NoIDSlug Source #

Creates a NoIDSlug where the ID-less slug is the alphanumeric words of the title with the spaces becoming dashes. Note that it's ID-less and only suitable as an intermediate representation.

mkSlug :: ArticleID -> NoIDSlug -> Slug Source #

Creates a Slug where a slug is "articleID-slugifiedTitle". Depends on a formerly built NoIDSlug.