[Haskell-cafe] Refactoring status

Peter Verswyvelen bf3 at telenet.be
Fri Jan 4 13:19:40 EST 2008

> Types cannot always be derived automatically, especially when coming to
> Haskell extensions. Sometimes you also want to restrict the type. E.g. for
> asTypeOf _ y = y
> you explicitly want the type
> asTypeOf :: a -> a -> a
> not the automatically derived one:
> asTypeOf :: b -> a -> a

Yes, sometimes it is neccerary to give an explicit type. But in so many
cases, type inference works fine no? What I usually do, is use the GHCi t:
command, copy/paste that in my code, and then make the type signature more
specific if it has to be. It's often funny to see how generic the code
really is :) 

I wonder what a typical LISP/Scheme programmer thinks of type signatures...

> It's a problem in Haskell that there are no unique parameter names, due to
> pattern matching. 

Yes, but it would be nice to attach some "parameter-comment" to the types
no? Now a lot of documentation is written in the style "the 7th parameter
is...". Not very user friendly :)


More information about the Haskell-Cafe mailing list