
Hi, David Kraeutmann wrote:
I'm working on a GHC feature [1] that allows users to view specializations of functions like in (name subject to change)
----
:binfo find find :: Foldable t => (a -> Bool) -> t a -> Maybe a Specialisations: t ~ [] => find :: (a -> Bool) -> [a] -> Maybe a
:binfo first first :: Arrow a => a b c -> a (b, d) (c, d) Specialisations: a ~ (->) => first :: (b -> c) -> (b, d) -> (c, d)
Looks very helpful. Three ideas: (1) I think this would be easier to read if the specialized type signature would come first. Maybe like this: find :: Foldable t => (a -> Bool) -> t a -> Maybe a Specializations: find :: (a -> Bool) -> [a] -> Maybe a -- if f ~ [] find :: (a -> Bool) -> Either b a -> Maybe a -- if f ~ Either b (2) Can this be made to work for expressions, too? $ :type-so-that-i-get-it find even find even :: (Foldable t, Integral a) => t a -> Maybe a Specializations: find even :: [Integer] -> Maybe Integer -- if t ~ [], a ~ Integer (3) Could the specializations also be shown in haddock documentation? Tillmann