URL shortening is just one use case for generating redirects. I wrote a similar module for Hakyll ('Hakyll.Web.Redirect'
https://hackage.haskell.org/package/hakyll-4.13.4.0/docs/Hak...) but my intent was to allow renaming pages without breaking links and fixing the (truly innumerable) number of user errors in linking/writing URLs.
Because every original URL must be a valid file name, it does limit you compared to the full rewrite capabilities of Apache or Nginx, but that's the price you pay for a fully-static site. (I thought vaguely about writing some JS you could put in a 404.html to snoop the intended URL and do a lookup in a table to redirect to, but never got around to figuring out the details.)