ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
753 stars 137 forks source link

Hoogle not finding function when I loosen type constraints #80

Open artella-coding opened 10 years ago

artella-coding commented 10 years ago

If I perform (with Hoogle v4.2.34) the following search on the command prompt, then I get results :

> hoogle +Data.ByteString.Lazy.Char8 ":: ByteString -> Maybe (Int,ByteString)" | grep readInt
Data.ByteString.Char8 readInt :: ByteString -> Maybe (Int, ByteString)
Data.ByteString.Lazy.Char8 readInt :: ByteString -> Maybe (Int, ByteString)

However if I loosen the typeconstraint to be just :: ByteString then nothing is returned.

> hoogle +Data.ByteString.Lazy.Char8 ":: ByteString" | grep readInt

Is this happening because hoogle is limiting the results returned, and if so is there a way that I can remove this limit? Thanks

artella-coding commented 10 years ago

I have also tried the search online : http://www.haskell.org/hoogle/?hoogle=%3a%3a+ByteString+%2bByteString.Lazy.Char8&start=41#more and readInt is not returned

ndmitchell commented 10 years ago

Just :: ByteString is not a loser constraint - I suspect you are after :: ByteString -> a as the loser result? Hoogle is quite strict about the last type mentioned being the return type, and won't search through that.

artella-coding commented 10 years ago

Hi, hoogle +Data.ByteString.Lazy.Char8 ":: ByteString -> a" | grep readInt also outputs nothing. Thanks.

ndmitchell commented 10 years ago

Looking closer, that is a case of a not being "similar enough" to Maybe (Int, ByteString). I have plans to introduce a _ variable to indicate that you don't care anything about the structure of the type, but haven't got anywhere with that yet.

artella-coding commented 10 years ago

OK thanks. On a separate note, do you have any idea why the search hoogle +Data.Vector ":: Int" yields nothing (see also http://www.haskell.org/hoogle/?hoogle=%3A%3A+Int+%2BData.Vector)? I would have thought that it should atleast return length in http://hackage.haskell.org/package/vector-0.10.11.0/docs/Data-Vector.html ?