diff options
Diffstat (limited to 'src/Data/Person.hs')
| -rw-r--r-- | src/Data/Person.hs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Data/Person.hs b/src/Data/Person.hs index c829fc4..853408e 100644 --- a/src/Data/Person.hs +++ b/src/Data/Person.hs @@ -1,5 +1,6 @@ module Data.Person ( Person (..) + , Person_ , personHtml , personFromName , Name (..) @@ -9,18 +10,13 @@ module Data.Person import Prolog import Data.Aeson import Data.Alias +import Data.Linked import Data.Name import Data.Set qualified as S import Network.URI (URI) -import Network.URI qualified as URI import Text.Blaze import Text.Blaze.Html -import Text.Blaze.Html5 (a) -import Text.Blaze.Html5.Attributes (href) --- | Huh, I guess I need a version bump for this guy? -instance FromJSON URI where - parseJSON = withText "URI" $ maybe (fail "Invalid URI") pure . URI.parseURI . toSL data Person a = Person { name :: !(Name a) @@ -29,10 +25,10 @@ data Person a = Person instance Binary a => Binary (Person a) +type Person_ = Person StrictText + personHtml :: (ToMarkup a) => Person a -> Html -personHtml (Person n w) = - let withLink = maybe id (\x -> a ! href (toValue x)) w - in withLink $ renderNameFML $ toMarkup <$> n +personHtml (Person n w) = linkedHtml $ Linked (renderNameFML $ toMarkup <$> n) w Nothing personFromName :: Name a -> Person a personFromName n = Person n Nothing |
