# How to use extype on at-view?

**URL:** <https://discourse.ats-lang.org/t/how-to-use-extype-on-at-view/58>\
**Category:** Google Group\
**Created:** [November 14, 2015, 12:46pm UTC](https://discourse.ats-lang.org/t/how-to-use-extype-on-at-view/58 "2015-11-14T12:46:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [November 14, 2015, 12:46pm UTC](https://discourse.ats-lang.org/t/how-to-use-extype-on-at-view/58/1 "2015-11-14T12:46:07Z")

</div>

There seems a misuse of quantifier:

typedef dns\_found\_callback\_t = {l:addr} (!ip\_addr\_t@l | string, ptr l, ptr)  
 → voidOn Saturday, November 14, 2015 at 7:06:37 AM UTC-5, Kiwamu Okabe wrote:

> Hi all,
> 
> I’m trying to make a function exported from C language.  
> ATS language side is following:
> 
> ```auto
> typedef dns_found_callback_t = [l:addr] (ip_addr_t@l | string, ptr l, 
> ptr) -> void 
> extern fun dns_done: dns_found_callback_t = "mac#" 
> implement dns_done (pfat | name, ipaddr, arg) = { 
> val () = dns_done_c (pfat | name, ipaddr, arg) // <= Error occurs at 
> here! 
> } 
> 
> ```
> 
> C language side is following:
> 
> ```auto
> void dns_done_c( const char *name, ip_addr_t *ipaddr, void *arg ) 
> { 
> ... 
> 
> ```
> 
> I believe the view will be removed after compile. However the code  
> can’t be compiled.
> 
> ```auto
> $ make 
> ATS user/user_main.dats 
> /home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats: 
> 1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): the 
> dynamic expression cannot be assigned the type 
> [S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1; addr=S2Ecst(uint32)), 
> S2Evar(l$3144(7279)))]. 
> /home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats: 
> 1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch 
> of sorts in unification: 
> The sort of variable is: S2RTbas(S2RTBASimp(1; t@ype)) 
> The sort of solution is: S2RTbas(S2RTBASimp(7; view)) 
> /home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats: 
> 1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch 
> of static terms (tyleq): 
> The actual term is: S2EVar(1955) 
> The needed term is: S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1; 
> addr=S2Ecst(uint32)); S2Evar(l$3144(7279))) 
> 
> ```
> 
> How to use extype on at-view?
> 
> ## Thanks,
> 
> Kiwamu Okabe at METASEPI DESIGN

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [November 14, 2015, 1:08pm UTC](https://discourse.ats-lang.org/t/how-to-use-extype-on-at-view/58/2 "2015-11-14T13:08:30Z")

</div>

What is the reason for having both: dns\_done and dns\_done\_c?

Are these two functions different?On Sat, Nov 14, 2015 at 8:02 AM, Kiwamu Okabe [kiw...@debian.or.jp](mailto:kiw...@debian.or.jp) wrote:

> On Sat, Nov 14, 2015 at 9:49 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:
> 
> > By the way, what is the type of dns\_done\_c?
> 
> ## extern fun dns\_done\_c: dns\_found\_callback\_t = “mac#”
> 
> Kiwamu Okabe at METASEPI DESIGN
> 
> –  
> 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-user...@googlegroups.com](mailto:ats-lang-user...@googlegroups.com).  
> To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> Visit this group at [http://groups.google.com/group/ats-lang-users](http://groups.google.com/group/ats-lang-users).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dmo%3DixkOOitbhyQ7kEWZVaG26KmsenyLrTdTTjqqRxumg%40mail.gmail.com](https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dmo%3DixkOOitbhyQ7kEWZVaG26KmsenyLrTdTTjqqRxumg%40mail.gmail.com)  
> .

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [November 14, 2015, 12:49pm UTC](https://discourse.ats-lang.org/t/how-to-use-extype-on-at-view/58/3 "2015-11-14T12:49:01Z")

</div>

By the way, what is the type of dns\_done\_c?On Saturday, November 14, 2015 at 7:06:37 AM UTC-5, Kiwamu Okabe wrote:

> Hi all,
> 
> I’m trying to make a function exported from C language.  
> ATS language side is following:
> 
> ```auto
> typedef dns_found_callback_t = [l:addr] (ip_addr_t@l | string, ptr l, 
> ptr) -> void 
> extern fun dns_done: dns_found_callback_t = "mac#" 
> implement dns_done (pfat | name, ipaddr, arg) = { 
> val () = dns_done_c (pfat | name, ipaddr, arg) // <= Error occurs at 
> here! 
> } 
> 
> ```
> 
> C language side is following:
> 
> ```auto
> void dns_done_c( const char *name, ip_addr_t *ipaddr, void *arg ) 
> { 
> ... 
> 
> ```
> 
> I believe the view will be removed after compile. However the code  
> can’t be compiled.
> 
> ```auto
> $ make 
> ATS user/user_main.dats 
> /home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats: 
> 1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): the 
> dynamic expression cannot be assigned the type 
> [S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1; addr=S2Ecst(uint32)), 
> S2Evar(l$3144(7279)))]. 
> /home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats: 
> 1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch 
> of sorts in unification: 
> The sort of variable is: S2RTbas(S2RTBASimp(1; t@ype)) 
> The sort of solution is: S2RTbas(S2RTBASimp(7; view)) 
> /home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats: 
> 1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch 
> of static terms (tyleq): 
> The actual term is: S2EVar(1955) 
> The needed term is: S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1; 
> addr=S2Ecst(uint32)); S2Evar(l$3144(7279))) 
> 
> ```
> 
> How to use extype on at-view?
> 
> ## Thanks,
> 
> Kiwamu Okabe at METASEPI DESIGN
