[Grace-core] Standard Prelude

Kim Bruce kim at cs.pomona.edu
Fri Jul 11 10:40:09 PDT 2014


As I looked back at this, I started thinking that a multipart type name would look even better.  Then I discovered that the current compiler does not understand multipart type names.  Not a high priority, but it might be nice to have.

Example:
type BlockFrom<T,U>To<V> = {
    apply(fst:T,snd:U> -> V
}

error message:
new9.grace[1:(21)]: Syntax error: A type declaration must have a '=' after the type name.
  1: type BlockFrom<T,U>To<V> = {
-------------------------^
  2:     apply(fst:T,snd:U> -> V

Did you mean:
  1: type BlockFrom<T,U>= {

Interestingly, the compiler seemed to insert a space between letters of "To"

Kim



On Jul 11, 2014, at 10:17 AM, Kim Bruce <kim at cs.pomona.edu> wrote:

> As we are talking about changes to the standard prelude, I'd like to suggest that we add block types as well.  I've been using the following notations:
> 
> type Block0<T> = {         // {...:T}
>    apply -> T
> }
> 
> type Block1<U,T> = {       // {u:U -> ...:T}
>    apply(elt:U) -> T
> }
> 
> type Block2<U,V,T> = {       // {u:U -> ...:T}
>    apply(fst: U, snd: V) -> T
> }
> 
> etc.
> 
> Having these standard names around would make it easier to give consistent names to types that make them easier for readers to understand.  (I.e., yes, I understand anyone can make up their own names, but consistent names are easier for people to understand once they learn them.)
> 
> Kim
> 
> 
> 
> 
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core




More information about the Grace-core mailing list