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

What are all the supported return types for =~? #28

Open
Martinsos opened this issue Nov 10, 2021 · 3 comments
Open

What are all the supported return types for =~? #28

Martinsos opened this issue Nov 10, 2021 · 3 comments
Labels
faq User question

Comments

@Martinsos
Copy link

Hi, thanks for this great library!

You mention in docs https://hackage.haskell.org/package/regex-tdfa-1.3.1.1/docs/Text-Regex-TDFA.html common use cases, and there is 4 of them. I am wondering, is that all or are there other supported return types? If there are, how can we discover them?

What I am looking specifically is for a way to get all of the matches together with their match, before/afterMatch and submatches, but on the other hand I would also love to know in general what else is support in the return type.

Thanks!

@andreasabel
Copy link
Member

Hi @Martinsos!
The type of ~= is very polymorphic, see https://hackage.haskell.org/package/regex-tdfa-1.3.1.1/docs/Text-Regex-TDFA.html#v:-61--126- . So maybe you can get your use case by a suitable instantiation of the involved type classes RegexMaker and RegexContext.

I am just a formal maintainer, I have not tried to use this package in earnest. If you want to discuss a specific implementation problem, stackoverflow or the haskell-cafe mailing list might be suitable venues.

If you have a useful addition to the documentation, consider a submitting a PR.

@andreasabel andreasabel added the faq User question label Nov 11, 2021
@Martinsos
Copy link
Author

Martinsos commented Nov 11, 2021

Thanks @andreasabel !
I have to admit reading the definition of =~ got me a bit confused, and while I don't want to waste any more of your time, I was hoping you could just point me a bit in the direction that might help me understand it better: I see the RegexContext Regex source1 target constraint -> so this is dictating what target can be. However, looking at list of instances below, I see only a couple of possible value for target: String, ByteString, Text and Seq Char. On the other hand, I know that I can specity output to be more complex stuff like (String, String, String, [String]) and similar. So obviously I am looking at it the wrong way somehow -> how should I look at it to be able to figure out which types are supported for target?

Thanks!

@andreasabel
Copy link
Member

(While I cannot contribute anything now, I leave this issue open so passers-by can get involved.)

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

No branches or pull requests

2 participants