Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- extractIDFromSlug :: Slug -> Either ArticleError ArticleID
- mkNoIDSlug :: Text -> NoIDSlug
- mkSlug :: ArticleID -> NoIDSlug -> Slug
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
Slug
s 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.