[Haskell-cafe] New type of ($) operator in GHC 8.0 is problematic

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sun Feb 7 11:46:16 UTC 2016


On 7 February 2016 at 22:08, Geraldus <heraldhoi at gmail.com> wrote:
>
> Hi, friends! I want to share my own feelings about type signatures. It is
> always hard for me to read type signatures with class constraints, because
> first I need to spot that there is =>, then I have to split type signature
> in my mind to constraint part and actual signature part. I think having
> constraints before signature when defining things is something that eases
> source parsing and etc., but wouldn't type signatures become a bit more
> readable if we put constraints after actual signature when printing it in
> GHCi (and maybe in Haddock), e.g.:
>
> ($) :: (a -> b) -> a -> b
>     forall r :: RuntimeRep
>            a :: *
>            b :: TYPE r

If this is only how ghci types/prints it, then it makes it much more
difficult (if not impossible) to just copy/paste the resulting type
into your code.

This also makes it much more verbose: it might be useful for longer
type signatures (especially with large constraints) but not for the
majority of them.  I also like being able to see the constraints first
so that I know what they are before reading the actual type.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list