Template and Effect

31 views
Skip to first unread message

Steinway Wu

unread,
Aug 11, 2016, 2:03:29 PM8/11/16
to ats-lang-users
Hi, 

I'm trying to implement `gcompare_val_val` for a datatype `list`, but encounters an error saying "some disallowed effects may be incurred: 1"

```
datatype list (a:t@ype) = ...

fun {a:t@ype} list_compare ...

implement (a) gcompare_val_val<list a> (x, y) = list_compare (x, y)
```

What is that effect? And how should I implement that template for `list a`? 

Thanks,

Hongwei Xi

unread,
Aug 11, 2016, 5:21:01 PM8/11/16
to ats-lan...@googlegroups.com

Try:

implement (a) gcompare_val_val<list a> (x, y) = $effmask_all( list_compare (x, y) )



--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/c4495032-e055-4cda-8d5f-45fa34d23838%40googlegroups.com.

Steinway Wu

unread,
Aug 12, 2016, 12:14:47 PM8/12/16
to ats-lang-users
This definitely works. but I don't think list_compare has any effect. Explicitly marking list_comare as (a, a):<> int seems to do the job as well
Reply all
Reply to author
Forward
0 new messages