ndmitchell / hoogle

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

Hoogling signatures with constraints #213

Open fredefox opened 7 years ago

fredefox commented 7 years ago

I think it would be a nice feature if hoogle could show results for signatures with matching types but additional constraints. Say I hoogle

(a -> b) -> f a -> f b

I would like for hoogle to suggest fmap. Also, it would be nice if hoogle was aware of subclass relationships so that the above would also be shown if I hoogle, say

Applicative f => (a -> b) -> f a -> f b

Any thoughts?

georgefst commented 3 years ago

It seems in some cases this already happens.

Anyway, I think it would be cool to allow syntax like _ => (a -> b) -> f a -> f b. Or even _ f => (a -> b) -> f a -> f b to only allow constraints on f. Although the latter is not valid in GHC.

ndmitchell commented 3 years ago

Agreed on all fronts - but it's hard. Someone will need to invest in looking at how it can work in the existing design.