[Haskell-cafe] Refactoring status

David Roundy droundy at darcs.net
Thu Jan 3 18:29:50 EST 2008


On Fri, Jan 04, 2008 at 02:23:31AM +0300, Bulat Ziganshin wrote:
> Thursday, January 3, 2008, 10:46:54 PM, you wrote:
> >> i don't use
> >> type signatures at all - this creates some problems when i wrote large
> >> portion of code and try to make it compile, but nothing more
> 
> > I believe type signatures are the very essence of Haskell documentation!
> > I'd much rather see a program with type signatures for functions and
> > little (or no) comments over programs with no type signatures and
> > ambigious comments (if any comments at all!).
> 
> > Type signatures really does make dealing with someone elses code that
> > much easier.
> 
> well, i don't worry about types of things with which i work. i know
> that it is a file, for example. its actual type depends on the
> information i need inside this function. it may start as FileInfo type,
> then after refactoring it will become CompressedFile or
> (fileInfo,FileSize) type. while it's great to know types of every
> variable to better understand how program works, adding type
> signatures means more work when writing program and when changing it.
> i want to express only data processing algorithm leaving all the
> details to compiler. for me, ghc just "reads thoughts"
> 
> types and type signatures was required in classic languages to fight
> with errors. but in haskell omitting type signatures doesn't make
> program less reliable, so i don't need to write this extra code in
> addition to the essential - algorithm itself. for the same reason, i
> like pointless notation

True, it's not necessary to *write* the type signatures, but it's often
helpful for those who want to read your code.  Of course, they could always
fire up ghci (with the right incantations) to find out the types of your
function, but that's not always convenient.  Also, type signatures often
make bugs much easier to pinpoint.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Haskell-Cafe mailing list