[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell
Subject:    annotated haskell
From:       Hal Daume <hdaume () ISI ! EDU>
Date:       2001-11-20 19:19:23
Message-ID: 200111201919.TAA25021 () moussor ! isi ! edu
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic