Skip to content

Commit

Permalink
Document namespace prefixes
Browse files Browse the repository at this point in the history
This patch adds simple Haddock documentation for namespace prefixes
generated from an RDFS or OWL file.
  • Loading branch information
pniedzielski committed Mar 20, 2024
1 parent bd44a8c commit f5d15d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Data/RDF/Vocabulary/Generator/VocabularyGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ declarePrefix name prefix iri =
let prefixLiteral = AppE packFun . LitE . StringL . T.unpack $ prefix
iriLiteral = AppE packFun . LitE . StringL . T.unpack $ iri
namespace = AppE (AppE mkPrefixedNSFun prefixLiteral) iriLiteral
in funD name [return $ Clause [] (NormalB namespace) []]
in funD_doc name [return $ Clause [] (NormalB namespace) []]
(Just $ "Namespace prefix for \\<<" <> T.unpack iri <> ">\\>.")
[Nothing]

iriToName :: Text -> Maybe Name
iriToName iri = mkName . T.unpack . escape <$> (lastMay . filter (not . T.null) . T.split (`elem` separators)) iri
Expand Down

0 comments on commit f5d15d8

Please sign in to comment.