# Porting ATS1 to ATS2: dealing with dataviewtypes

**URL:** <https://discourse.ats-lang.org/t/porting-ats1-to-ats2-dealing-with-dataviewtypes/654>\
**Category:** Google Group\
**Created:** [January 11, 2014, 11:56pm UTC](https://discourse.ats-lang.org/t/porting-ats1-to-ats2-dealing-with-dataviewtypes/654 "2014-01-11T23:56:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [January 11, 2014, 11:56pm UTC](https://discourse.ats-lang.org/t/porting-ats1-to-ats2-dealing-with-dataviewtypes/654/1 "2014-01-11T23:56:07Z")

</div>

In minDisjNoCov.dats[https://github.com/bbarker/FALCON/blob/f639705e90fc79a32c9e46df44b17da19d5797b1/minDisjNoCov.dats](https://github.com/bbarker/FALCON/blob/f639705e90fc79a32c9e46df44b17da19d5797b1/minDisjNoCov.dats), the first round of errors suggest something is wrong with functions  
accessing dataviewtypes, e.g, the following codeblock has problems (lines  
311-328):

fun GREXP\_copy(gr: !GREXP): GREXP = case+ gr of  
| GRgenes(!g) =\> let  
val x = genes\_copy(!g) prval () = fold@ gr  
in GRgenes(x) end  
| GRconj(!g) =\> let  
val x = genes\_copy(!g) prval () = fold@ gr  
in GRconj(x) end  
| GRdisj(!g) =\> let  
val x = genes\_copy(!g) prval () = fold@ gr  
in GRdisj(x) end  
| GRconj(!lx,!rx) =\> let  
val x = GRconj(GREXP\_copy(!lx),GREXP\_copy(!rx))  
prval () = fold@ gr  
in x end  
| GRdisj(!lx,!rx) =\> let  
val x = GRdisj(GREXP\_copy(!lx),GREXP\_copy(!rx))  
prval () = fold@ gr  
in x end

patscc -tcats /home/brand\_000/FBA/FALCON/minDisjNoCov.dats  
exec(patsopt --typecheck --dynamic  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats)  
Hello from ATS2(ATS/Postiats)!  
Loading [fixity.ats] starts!  
Loading [fixity.ats] finishes!  
Loading [basics\_pre.sats] starts!  
Loading [basics\_pre.sats] finishes!  
Loading [basics\_sta.sats] starts!  
Loading [basics\_sta.sats] finishes!  
Loading [basics\_dyn.sats] starts!  
Loading [basics\_dyn.sats] finishes!  
Loading [basics\_gen.sats] starts!  
Loading [basics\_gen.sats] finishes!  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7706(line=312, offs=13) –  
7707(line=312, offs=14): error(parsing): the keyword ‘)’ is needed.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7705(line=312, offs=12) –  
7706(line=312, offs=13): error(parsing): the syntactic entity [c0lau] is  
needed.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7698(line=312, offs=5) –  
7705(line=312, offs=12): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7770(line=314, offs=5) –  
7772(line=314, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7865(line=317, offs=5) –  
7867(line=317, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7956(line=320, offs=5) –  
7958(line=320, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 8081(line=324, offs=5) –  
8083(line=324, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 8198(line=328, offs=5) –  
8200(line=328, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 12821(line=501, offs=13) –  
12822(line=501, offs=14): error(parsing): the keyword ‘)’ is needed.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 12820(line=501, offs=12) –  
12821(line=501, offs=13): error(parsing): the syntactic entity [c0lau] is  
needed.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 12813(line=501, offs=5) –  
12819(line=501, offs=11): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13218(line=510, offs=7) –  
13220(line=510, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13347(line=515, offs=7) –  
13349(line=515, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13480(line=520, offs=7) –  
13482(line=520, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13610(line=525, offs=7) –  
13612(line=525, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13745(line=529, offs=7) –  
13747(line=529, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13855(line=534, offs=5) –  
13857(line=534, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14096(line=539, offs=7) –  
14098(line=539, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14276(line=545, offs=7) –  
14278(line=545, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14461(line=551, offs=7) –  
14463(line=551, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14567(line=554, offs=7) –  
14569(line=554, offs=9): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14687(line=559, offs=5) –  
14689(line=559, offs=7): error(parsing): the token is discarded.  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 15042(line=570, offs=5) –  
15044(line=570, offs=7): error(parsing): the token is discarded.  
exit(ATS): uncaught exception:  
\_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorException(1025)  
exec(patsopt --typecheck --dynamic  
/home/brand\_000/FBA/FALCON/minDisjNoCov.dats) = 256

Compilation exited abnormally with code 1 at Sat Jan 11 18:49:13

---

<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:** [January 12, 2014, 2:04am UTC](https://discourse.ats-lang.org/t/porting-ats1-to-ats2-dealing-with-dataviewtypes/654/2 "2014-01-12T02:04:33Z")

</div>

There is some significant difference between ATS1 and ATS2  
in terms of dataviewtype handling.

First, you can call datavtype for dataviewtype.

If you are not going to modify a dataviewtype-value, then it should be  
handled  
as a datatype value. So your function can now be written as follows:

fun GREXP\_copy (gr: !GREXP): GREXP =  
case+ gr of  
| GRgenes (g) =\> GRgenes (genes\_copy (g))  
| …On Saturday, January 11, 2014 6:56:07 PM UTC-5, Brandon Barker wrote:

> In minDisjNoCov.dats[https://github.com/bbarker/FALCON/blob/f639705e90fc79a32c9e46df44b17da19d5797b1/minDisjNoCov.dats](https://github.com/bbarker/FALCON/blob/f639705e90fc79a32c9e46df44b17da19d5797b1/minDisjNoCov.dats), the first round of errors suggest something is wrong with functions  
> accessing dataviewtypes, e.g, the following codeblock has problems (lines  
> 311-328):
> 
> fun GREXP\_copy(gr: !GREXP): GREXP = case+ gr of  
> | GRgenes(!g) =\> let  
> val x = genes\_copy(!g) prval () = fold@ gr  
> in GRgenes(x) end  
> | GRconj(!g) =\> let  
> val x = genes\_copy(!g) prval () = fold@ gr  
> in GRconj(x) end  
> | GRdisj(!g) =\> let  
> val x = genes\_copy(!g) prval () = fold@ gr  
> in GRdisj(x) end  
> | GRconj(!lx,!rx) =\> let  
> val x = GRconj(GREXP\_copy(!lx),GREXP\_copy(!rx))  
> prval () = fold@ gr  
> in x end  
> | GRdisj(!lx,!rx) =\> let  
> val x = GRdisj(GREXP\_copy(!lx),GREXP\_copy(!rx))  
> prval () = fold@ gr  
> in x end
> 
> patscc -tcats /home/brand\_000/FBA/FALCON/minDisjNoCov.dats  
> exec(patsopt --typecheck --dynamic  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats)  
> Hello from ATS2(ATS/Postiats)!  
> Loading [fixity.ats] starts!  
> Loading [fixity.ats] finishes!  
> Loading [basics\_pre.sats] starts!  
> Loading [basics\_pre.sats] finishes!  
> Loading [basics\_sta.sats] starts!  
> Loading [basics\_sta.sats] finishes!  
> Loading [basics\_dyn.sats] starts!  
> Loading [basics\_dyn.sats] finishes!  
> Loading [basics\_gen.sats] starts!  
> Loading [basics\_gen.sats] finishes!  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7706(line=312, offs=13) –  
> 7707(line=312, offs=14): error(parsing): the keyword ‘)’ is needed.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7705(line=312, offs=12) –  
> 7706(line=312, offs=13): error(parsing): the syntactic entity [c0lau] is  
> needed.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7698(line=312, offs=5) –  
> 7705(line=312, offs=12): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7770(line=314, offs=5) –  
> 7772(line=314, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7865(line=317, offs=5) –  
> 7867(line=317, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 7956(line=320, offs=5) –  
> 7958(line=320, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 8081(line=324, offs=5) –  
> 8083(line=324, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 8198(line=328, offs=5) –  
> 8200(line=328, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 12821(line=501, offs=13) –  
> 12822(line=501, offs=14): error(parsing): the keyword ‘)’ is needed.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 12820(line=501, offs=12) –  
> 12821(line=501, offs=13): error(parsing): the syntactic entity [c0lau] is  
> needed.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 12813(line=501, offs=5) –  
> 12819(line=501, offs=11): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13218(line=510, offs=7) –  
> 13220(line=510, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13347(line=515, offs=7) –  
> 13349(line=515, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13480(line=520, offs=7) –  
> 13482(line=520, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13610(line=525, offs=7) –  
> 13612(line=525, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13745(line=529, offs=7) –  
> 13747(line=529, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 13855(line=534, offs=5) –  
> 13857(line=534, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14096(line=539, offs=7) –  
> 14098(line=539, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14276(line=545, offs=7) –  
> 14278(line=545, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14461(line=551, offs=7) –  
> 14463(line=551, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14567(line=554, offs=7) –  
> 14569(line=554, offs=9): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 14687(line=559, offs=5) –  
> 14689(line=559, offs=7): error(parsing): the token is discarded.  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats: 15042(line=570, offs=5) –  
> 15044(line=570, offs=7): error(parsing): the token is discarded.  
> exit(ATS): uncaught exception:  
> \_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorException(1025)  
> exec(patsopt --typecheck --dynamic  
> /home/brand\_000/FBA/FALCON/minDisjNoCov.dats) = 256
> 
> Compilation exited abnormally with code 1 at Sat Jan 11 18:49:13
