diff options
| author | Chris Wells <chris@mathematicaster.org> | 2025-02-10 12:48:38 -0600 |
|---|---|---|
| committer | Chris Wells <chris@mathematicaster.org> | 2025-02-10 12:48:38 -0600 |
| commit | 0c677070edf9978cb85a0b521f7e6e0ef6d6b491 (patch) | |
| tree | 1bf0a024ea2c1ccc9c21c68b916e76017bafd310 /src/Data/Person.hs | |
| parent | 75ac829ee7d661d758f7828e609e28ee4e05d038 (diff) | |
| download | main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.tar main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.tar.gz main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.tar.bz2 main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.tar.lz main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.tar.xz main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.tar.zst main-0c677070edf9978cb85a0b521f7e6e0ef6d6b491.zip | |
A lot of work on aliases and the like
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 |
