diff options
| author | Volpeon <github@volpeon.ink> | 2023-05-26 07:40:13 +0200 |
|---|---|---|
| committer | Volpeon <github@volpeon.ink> | 2023-05-26 07:40:13 +0200 |
| commit | 11d0fb47c292a0ca25a9c377499d2b221d97a5cb (patch) | |
| tree | e729e2a4508763b3073b7eae9a56bc9c6a9ca0f7 /src/Data/JLD/Model/URI.hs | |
| download | hs-jsonld-11d0fb47c292a0ca25a9c377499d2b221d97a5cb.tar.gz hs-jsonld-11d0fb47c292a0ca25a9c377499d2b221d97a5cb.tar.bz2 hs-jsonld-11d0fb47c292a0ca25a9c377499d2b221d97a5cb.zip | |
Init
Diffstat (limited to 'src/Data/JLD/Model/URI.hs')
| -rw-r--r-- | src/Data/JLD/Model/URI.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Data/JLD/Model/URI.hs b/src/Data/JLD/Model/URI.hs new file mode 100644 index 0000000..07cf8a9 --- /dev/null +++ b/src/Data/JLD/Model/URI.hs | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | module Data.JLD.Model.URI (parseUri, uriToIri) where | ||
| 2 | |||
| 3 | import Data.JLD.Prelude | ||
| 4 | |||
| 5 | import Data.RDF (IRIRef, parseIRI) | ||
| 6 | import Text.Megaparsec (MonadParsec (..), Parsec, runParser) | ||
| 7 | import Text.URI (URI, parser, render) | ||
| 8 | |||
| 9 | parseUri :: Text -> Maybe URI | ||
| 10 | parseUri = runParser (parser <* eof :: Parsec Void Text URI) "" .> either (const Nothing) Just | ||
| 11 | |||
| 12 | uriToIri :: URI -> Maybe IRIRef | ||
| 13 | uriToIri = render .> parseIRI .> either (const Nothing) Just | ||
