Skip to content
New issue

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

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

Already on GitHub? # to your account

Where is the Iso' Text String? #1062

Open
kindaro opened this issue Mar 14, 2024 · 5 comments
Open

Where is the Iso' Text String? #1062

kindaro opened this issue Mar 14, 2024 · 5 comments

Comments

@kindaro
Copy link

kindaro commented Mar 14, 2024

Take a look at this definition:

string  Iso' Text String
string = iso Text.unpack Text.pack

I thought I shall find it in lens. I do not see why it should not be there:

  • lens already depends on text.
  • There is already a type class Reversing that defines an instance for Text.

Yet I could not find anything like this.

  • If it is not there, can we add it?
  • If it is there, can we make it easier to find?
@ocharles
Copy link
Contributor

ocharles commented Mar 14, 2024

It's unpacked: https://hackage.haskell.org/package/lens-5.2.3/docs/Data-Text-Lens.html

@kindaro
Copy link
Author

kindaro commented Mar 14, 2024

Makes sense. I did not think this stuff would be in a module of its own.

However, Hoogle cannot find these functions by type. I go by the link https://hoogle.haskell.org/?hoogle=Iso%27%20String%20text and there is nothing. Hoogle can find them by name though: the link https://hoogle.haskell.org/?hoogle=packed gives all the right hits from lens. What am I doing wrong?

@ocharles
Copy link
Contributor

I don't think Stackage knows about type aliases

@RyanGlScott
Copy link
Collaborator

Hoogle is a bit quirky. If you search for :: Iso' String text (note the double colons), then packed does appear in the search results, albeit not as the first result. If you refine the search further to :: Iso' String Text, then it's the first result.

@phadej
Copy link
Collaborator

phadej commented Mar 14, 2024

... it's indeed quirky, as the expansion :: Iso String String Text Text doesn't result in packed. I.e. you need to know what to search for find anything. Hoogle treats types as opaque, and in type-alias heavy library it's not great (even with optics where full expansion still "makes sense", Hoogle doesn't find anything).

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

No branches or pull requests

4 participants