On Wednesday 11 July 2007, Hugh Perkins wrote: > Well, there's a fundamental reason it wont work for Haskell: we dont > actually define the names of the parameters to the function! > > Have a look at the function above, the function is defined as: > > testunique' :: Eq a => [a] -> [a] -> [a] > testunique' [] elementssofar = [] > testunique' (x:xs) elementssofar > > There's an agreement here that the second parameter is called > "elementssofar"... but only because I was consistent in my naming in this > example. What if we had multiple constructors for a particular type? > > The first argument has no obvious naming at all. > > We could do things like write it in comments: > > testunique' :: Eq a => [a] -> [a] -> [a] > -- testunique' :: remainingelements -> elementssofar -> uniqueelements > testunique' [] elementssofar = [] > testunique' (x:xs) elementssofar > > ... but we all know that no-one bothers writing comments, and certainly > never maintaining them, and in any case this is becoming insanely difficult > to read. > > I dont have a solution, apart from using C# for production programming ;-) > , but things like this are really important to solve in any "mainstream" > version of Haskell.
One could put up the Haddock doc-comment. Or, say, one could extend Haddock to support parameter names: testunique' :: Eq a => [a] -- ^ $list List of elements to test -> [a] -- ^ $elementssofar List of elements seen thus far -> [a] -- ^ List of unique elements in 'list'. No patch forthcoming from this corner, though. Jonathan Cast http://sourceforge.net/projects/fid-core http://sourceforge.net/projects/fid-emacs _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe