{- This file is part of Vervis. - - Written 2019 by fr33domlover . - - ♡ Copying is an act of love. Please copy, reuse and share. - - The author(s) have dedicated all copyright and related and neighboring - rights to this software to the public domain worldwide. This software is - distributed without any warranty. - - You should have received a copy of the CC0 Public Domain Dedication along - with this software. If not, see - . -} module Yesod.FedURI ( getEncodeRouteFed , getEncodeRouteLocal ) where import Prelude import Yesod.Core import Yesod.Core.Handler import Network.FedURI getEncodeRouteFed :: MonadHandler m => m (Route (HandlerSite m) -> FedURI) getEncodeRouteFed = toFed <$> getUrlRender where toFed renderUrl route = case parseFedURI $ renderUrl route of Left e -> error $ "getUrlRender produced invalid FedURI: " ++ e Right u -> u getEncodeRouteLocal :: MonadHandler m => m (Route (HandlerSite m) -> LocalURI) getEncodeRouteLocal = (\ f -> snd . f2l . f) <$> getEncodeRouteFed