annotated haskell

Hal Daume hdaume@ISI.EDU
Tue, 20 Nov 2001 19:19:23 GMT


Hi,

Is there any development effort to create a Haskell
interpreter/compiler/sublanguage that is annotated?  For instance, I
might be able to say something like:

> sortByF f = sortBy (\a b -> compare (f a) (f b))
>
> longest [] = error "longest on empty list"
> longest (x:xs) = longest' xs (length x)
>     where longest' [] len = len
> 	    longest' (x:xs) len | length x > len = longest' xs (length x)
>			        | otherwise = longest' xs len
>
> x = sortByF length (a long list of lists)
> y = sortByF (longest y - . length) (another long list of lists)

obviously x will evaluate properly and will sort it's list by length.
y, whose intention is basically to sort by reverse length (yes, I know
there are other ways to doing this), will error with "Loop" for
obvious reasons.

however, intuitively, we all know that the sorting of y doesn't affect
the length of the longest element therein.  is there any language
extension that allows you to make these annotates in the definitions
of longest and sortByF that would enable this definition of y to not
produce an error?

thanks!

 - hal

-- 
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume