5

I am following a video that was recorded about two years ago. The speaker enters Either a b -> IO b in the public Hoogle search input and the result contains (among others):

either :: (a -> c) -> (b -> c) -> Either a b -> c

If I try it today, this result is not found, which is a pity. Similar results are found, like

fromEither :: (Exception e, MonadIO m) => Either e a -> m a

but they are less ready-to-use.

How can this be explained? Has the Hoogle search algorithm gotten stricter? Has Either changed?

dfeuer
  • 48,079
  • 5
  • 63
  • 167
Marco Faustinelli
  • 3,734
  • 5
  • 30
  • 49
  • 3
    Not an answer but just a remark: https://github.com/ndmitchell/hoogle/blob/master/docs/TypeSearch.md defines how it works currently. – Caramiriel Sep 20 '19 at 10:49
  • 1
    I would argue that your second result is actually a much better fit for the search than your first result. So I see this as an improvement! – bradrn Sep 20 '19 at 11:19
  • I daresay that the version from today is definitely _much closer_ to what you searched for. The signature of `either` is very different from what you searched for; if Hoogle shows all just _remotely_ related signatures from hundreds of packages than how are you supposed to find the right one there? – leftaroundabout Sep 20 '19 at 11:19
  • 1
    Worse, this gets no results at all: `(a -> IO c) -> (b -> IO c) -> Either a b -> IO c`. – dfeuer Sep 20 '19 at 11:25
  • @dfeuer that, indeed, is a bit sad. – leftaroundabout Sep 20 '19 at 12:50

1 Answers1

8

The code has changed completely since the last time you tried it. In particular, it now scales up to all of Stackage (~2K packages), gets updated every night and takes a bounded amount of time per query (certain queries like searching for the type a could make the old Hoogle take up a huge amount of time and memory). Completely rewriting the type search algorithm impacted almost all queries - some got better, some worse, and in some cases, what is better or worse is hard to define. This blog post serves as an overview of what happened and this issue tracker can be used for searches you think could be improved.

Neil Mitchell
  • 9,090
  • 1
  • 27
  • 85