Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRIError and SchemaError are not used #57

Open
robstewart57 opened this issue Jul 23, 2018 · 2 comments
Open

IRIError and SchemaError are not used #57

robstewart57 opened this issue Jul 23, 2018 · 2 comments
Labels

Comments

@robstewart57
Copy link
Owner

ping @wismill

Where are IRIError and SchemaError used?

I would've thought that the left value for the following functions:

mkIRI :: Text -> Either String IRI
parseIRI :: Text -> Either String IRIRef
parseRelIRI :: Text -> Either String IRIRef
validateIRI :: Text -> Either String Text
resolveIRI :: Text -> Text -> Either String Text

Would be IRIError or SchemaError rather than String?

@wismill
Copy link
Contributor

wismill commented Jul 23, 2018

You are right, they are not used yet. The compiler did not catch this because they are in the export list.

Maybe we could keep things simple and use the parser combinator <?> to make the error message and remove IRIError and SchemaError?

@robstewart57
Copy link
Owner Author

Maybe we could keep things simple and use the parser combinator <?> to make the error message and remove IRIError and SchemaError?

Sounds sensible to keep things simple.

How about using the library's existing ParseFailure:

newtype ParseFailure = ParseFailure String

E.g. it's used

class RdfParser p where

in

class RdfParser p where
  parseString :: (Rdf a) => p -> Text -> Either ParseFailure (RDF a)
  parseFile :: (Rdf a) => p -> String -> IO (Either ParseFailure (RDF a))
  parseURL :: (Rdf a) => p -> String -> IO (Either ParseFailure (RDF a))

I.e.

mkIRI :: Text -> Either ParseFailure IRI
parseIRI :: Text -> Either ParseFailure IRIRef
parseRelIRI :: Text -> Either ParseFailure IRIRef
validateIRI :: Text -> Either ParseFailure Text
resolveIRI :: Text -> Text -> Either ParseFailure Text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants