
On Fri, Feb 5, 2016 at 2:16 PM, Takenobu Tani
Hi,
I'll worry about the learning curve of beginners. Maybe, beginners will try following session in their 1st week.
ghci> :t foldr ghci> :t ($)
They'll get following result.
Before ghc7.8:
Prelude> :t foldr foldr :: (a -> b -> b) -> b -> [a] -> b
Prelude> :t ($) ($) :: (a -> b) -> a -> b
Beginners should only understand about following:
* type variable (polymorphism)
After ghc8.0:
Prelude> :t foldr foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
If the output was the following it would be more understandable (and more encouraging!) """ Prelude> :t foldr foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b For example: foldr :: (a -> b -> b) -> b -> [a] -> b foldr :: (a -> b -> b) -> b -> Maybe a -> b foldr :: (a -> b -> b) -> b -> Identity a -> b foldr :: (a -> b -> b) -> b -> (c, a) -> b and more """ It is easy to see a pattern here. The order of the instances used could be the load order, so the ones from Prelude would come first.
Prelude> :t ($) ($) :: forall (w :: GHC.Types.Levity) a (b :: TYPE w). (a -> b) -> a -> b
I'm not sure how this would work here, but when Levity is *, this should collapse into the old syntax, so: """ Prelude> :t ($) ($) :: <"unreadable blurb"> For example: ($) :: (a -> b) -> a -> b ($) :: forall a (b :: #). (a -> b) -> a -> b """ At least one of those lines should be understandable. Alexander