tomasz.zielonka: > On Wed, Aug 23, 2006 at 01:28:57PM +0100, Malcolm Wallace wrote: > > The lengths people will go to in making things difficult for the reader, > > just to save a few characters is truly amazing. Remember, the code will > > be read many more times than it is written. IMHO, the various proposed > > sugar adds nothing helpful, and just muddies understanding. > > Seconded. If someone just wants to type less characters, the he/she > can omit most of type signatures. > > I haven't used any IDE for Haskell (like VisualHaskell), but it would be > nice if it could fill the missing type signatures automatically. In > cases when monomorphism restriction kicks in, it could also present the > type that would be inferred with MR turned off.
I use the following script from vim to infer top level type declarations for me. I've found it particularly useful for understanding others' code: #!/bin/sh # input is a top level .hs decls FILE=$* DECL=`cat` ID=`echo $DECL | sed 's/^\([^ ]*\).*/\1/'` echo ":t $ID" | ghci -v0 -cpp -fglasgow-exts -w $FILE echo $DECL Saved to 'typeOf', you can bind it from vim with: :map ty :.!typeOf %^M in your .vimrc So, from vim the following source: f (x,y,z) a b = y + a + b hit, 'ty' and its replaced with: f :: forall b c a. (Num b) => (a, b, c) -> b -> b -> b f (x,y,z) a b = y + a + b I imagine it would be possible to bind from emacs with little effort. -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe