ekmett/lens

Where is the `Iso' Text String`?

Opened this issue · 5 comments

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?

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?

I don't think Stackage knows about type aliases

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.

... 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).