[Haskell-cafe] Displaying specializations in :info or separately?

Richard Eisenberg eir at cis.upenn.edu
Tue Oct 20 15:11:30 UTC 2015


On Oct 20, 2015, at 9:21 AM, Tillmann Rendel <rendel at informatik.uni-tuebingen.de> wrote:

> 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

Yes -- I like this more, too.

> 
> 
> (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

I like this, too. And this example also brings up the possibility of a combinatorial number of specializations that could be printed. We'd want to limit it, I think.

> 
> 
> (3) Could the specializations also be shown in haddock documentation?

Yes yes yes please please please.

Richard

> 
>  Tillmann
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list