I understand (but not completely how) dataviewtypes have changed in ATS2.
That aside, there are likely numerous errors here that I should not be
having if I remembered everything I learned in ATS1 being that the output
of patsopt reminds me of some of my worst C++ compiler errors involving
heavy use of template libraries :).
.dats:
implement{a}
linset_union
(xs1, xs2) = let
//
fun aux // non-tail-recursive
{n1,n2:nat} .<n1+n2>.
(
xs1: list (a, n1), xs2: list (a, n2)
) :<> List0_vt (a) = let // should be able to return e.g. listGte_vt(a, n3)
in // where n3 >= min(n1, n2)
//
case xs1 of
| list_vt_cons
(x1, xs11) =>
Highlighted part gives the error:
/home/brand_000/ATS-Postiats/libats/DATS/linset_listord.dats:
10284(line=534, offs=3) – 10311(line=535, offs=15): error(3): the
constructor pattern cannot be assigned the type
[S2Eapp(S2Ecst(list_t0ype_int_type); S2Evar(a(7153)), S2Evar(n1(7155)))].
/home/brand_000/ATS-Postiats/libats/DATS/linset_listord.dats:
10338(line=538, offs=5) – 10361(line=538, offs=28): error(3): the
constructor pattern cannot be assigned the type
[S2Eapp(S2Ecst(list_t0ype_int_type); S2Evar(a(7153)), S2Evar(n2(7156)))].
I’m still having some trouble getting used to linear datatypes in ATS2,
though it looks like it will be a bit more straightforward than in ATS1.
Here’s an attempt for list_union; trouble seems to occur around free@ -
something to do with making the unfolded dataviewtypes inaccessible, but
i’m not sure how to get around that.
One other thing I’m unsure about is what is going on with bindings like:
That’ll do it … typo (due to copy/paste from funset).On Monday, January 13, 2014 12:22:01 AM UTC-5, gmhwxi wrote:
xs1 is given the type list(a) but the constructor list_vt_cons is used;
list_cons should be used instead.
On Sunday, January 12, 2014 11:18:57 PM UTC-5, Brandon Barker wrote:
I understand (but not completely how) dataviewtypes have changed in ATS2.
That aside, there are likely numerous errors here that I should not be
having if I remembered everything I learned in ATS1 being that the output
of patsopt reminds me of some of my worst C++ compiler errors involving
heavy use of template libraries :).
.dats:
implement{a}
linset_union
(xs1, xs2) = let
//
fun aux // non-tail-recursive
{n1,n2:nat} .<n1+n2>.
(
xs1: list (a, n1), xs2: list (a, n2)
) :<> List0_vt (a) = let // should be able to return e.g. listGte_vt(a,
n3)
in // where n3 >= min(n1, n2)
//
case xs1 of
| list_vt_cons
(x1, xs11) =>
Highlighted part gives the error:
/home/brand_000/ATS-Postiats/libats/DATS/linset_listord.dats:
10284(line=534, offs=3) – 10311(line=535, offs=15): error(3): the
constructor pattern cannot be assigned the type
[S2Eapp(S2Ecst(list_t0ype_int_type); S2Evar(a(7153)), S2Evar(n1(7155)))].
/home/brand_000/ATS-Postiats/libats/DATS/linset_listord.dats:
10338(line=538, offs=5) – 10361(line=538, offs=28): error(3): the
constructor pattern cannot be assigned the type
[S2Eapp(S2Ecst(list_t0ype_int_type); S2Evar(a(7153)), S2Evar(n2(7156)))].
left off an “end” at the end of the pasted implementation.On Thursday, January 16, 2014 12:01:54 PM UTC-5, Brandon Barker wrote:
I’m still having some trouble getting used to linear datatypes in ATS2,
though it looks like it will be a bit more straightforward than in ATS1.
Here’s an attempt for list_union; trouble seems to occur around free@ -
something to do with making the unfolded dataviewtypes inaccessible, but
i’m not sure how to get around that.
One other thing I’m unsure about is what is going on with bindings like:
xs1 is given the type list(a) but the constructor list_vt_cons is used;
list_cons should be used instead.On Sunday, January 12, 2014 11:18:57 PM UTC-5, Brandon Barker wrote:
I understand (but not completely how) dataviewtypes have changed in ATS2.
That aside, there are likely numerous errors here that I should not be
having if I remembered everything I learned in ATS1 being that the output
of patsopt reminds me of some of my worst C++ compiler errors involving
heavy use of template libraries :).
.dats:
implement{a}
linset_union
(xs1, xs2) = let
//
fun aux // non-tail-recursive
{n1,n2:nat} .<n1+n2>.
(
xs1: list (a, n1), xs2: list (a, n2)
) :<> List0_vt (a) = let // should be able to return e.g. listGte_vt(a,
n3)
in // where n3 >= min(n1, n2)
//
case xs1 of
| list_vt_cons
(x1, xs11) =>
Highlighted part gives the error:
/home/brand_000/ATS-Postiats/libats/DATS/linset_listord.dats:
10284(line=534, offs=3) – 10311(line=535, offs=15): error(3): the
constructor pattern cannot be assigned the type
[S2Eapp(S2Ecst(list_t0ype_int_type); S2Evar(a(7153)), S2Evar(n1(7155)))].
/home/brand_000/ATS-Postiats/libats/DATS/linset_listord.dats:
10338(line=538, offs=5) – 10361(line=538, offs=28): error(3): the
constructor pattern cannot be assigned the type
[S2Eapp(S2Ecst(list_t0ype_int_type); S2Evar(a(7153)), S2Evar(n2(7156)))].
Thanks, I think I see: if RHS is a reference to a value of some viewtype,
val LHS = RHS
then LHS is the value of that viewtype itself. However, $showtype was not
very clear on this, but the type of xs11 did seem to change after the val
statement, but I wouldn’t that is correct.
$showtype(xs11) //says something about the viewtype (list_vt)
val xs11_ = xs11
$showtype(xs11_) //says something about the viewtype
$showtype(xs11) //also says something about the viewtype
I think in ATS1, we had to do:
val LHS = !RHS.On Thursday, January 16, 2014 5:16:33 PM UTC-5, gmhwxi wrote: