Re: error messages

2020-08-03 Thread Timmy Jose
Hey Richard,

I tried out the acc wrapper with my code samples, and it works very nicely 
indeed - the formatting is superb, and showing the actual line where the 
error was triggered is extremely helpful. Such a simple tool, and yet it 
has made life much easier! :-)

Best,

Timmy

On Monday, August 3, 2020 at 10:33:46 PM UTC+5:30 Richard wrote:

> Hi Timmy,
>
> Here is a tool that displays the compiler error messages in a more 
> consumable way: https://github.com/sparverius/ats-acc. 
>
> Hope it helps!
>
> - Richard
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/4481a514-a2ef-49e5-bd51-06143b732dd9n%40googlegroups.com.


Re: error messages

2020-08-03 Thread Timmy Jose
Hello Richard 

That looks very promising. In fact, that looks exactly like what I need right 
now. Thank you for sharing the tool! :-)

Cheers,

Timmy

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/713a6c6b-05e1-4bb7-905b-bc58d2ce31f3o%40googlegroups.com.


Re: error messages

2020-08-03 Thread Richard
Hi Timmy,

Here is a tool that displays the compiler error messages in a more consumable 
way: https://github.com/sparverius/ats-acc. 

Hope it helps!

- Richard

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/37ec2e94-2f68-48d9-8b59-d271c4dd5368o%40googlegroups.com.


Re: error messages

2020-08-03 Thread Timmy Jose
That looks very interesting! 

Yes, I'm still ploughing through the basic tutorial (I plan to complete all 
the tutorials in order), and it's been quite enjoyable so far. And you're 
absolutely right, the syntax reminds me a lot of ML (I have experience with 
OCaml rather than ML/SML, but still!). I can't wait till I reach the 
dependent and linear types section. 

As an aside, I saw the message about ATS3 and your explicit aims of making 
ATS production-ready. This is very heartening news indeed. I had given ATS 
a go a couple of years back, and was quickly deterred by how different it 
was even from other functional-oriented languages. However, I'm having a 
much smoother time this time around, and
hope to be able to contribute towards this effort of making ATS3 
production-viable. I think it is a very unique and powerful language, and 
quite logical as well. I just hope that ATS3 is not that different from 
ATS2 ... hahaha.

Thanks for the help! :-)

On Monday, August 3, 2020 at 8:27:47 PM UTC+5:30 gmhwxi wrote:

> By the way, an ifcase-expression should be used in place of the 
> case-expression
> in your code. Also, I would like to point out that templates are a shining 
> feature of ATS :)
>
> ##
>
> datatype
> bstree(a:t@ype) =
> | E of ()
> | B of (bstree(a), a, bstree(a))
>
> fun
> {a:t@ype}
> bstree_search
> (
>  t0: bstree(a),
>  k0: a
>
> ) : bool =
> case+ t0 of
> | E () => false
> | B (t1, k, t2) =>
>   let
>   val sgn =
>   gcompare_val_val(k0, k)
>   in
>   ifcase
>
>   | sgn < 0 => bstree_search (t1, k0)
>   | sgn > 0 => bstree_search (t2, k0)
>   | _ (* else *) => true
>   end
>
>
> On Mon, Aug 3, 2020 at 10:43 AM Hongwei Xi  wrote:
>
>> There is a COMMA following 'false' that should be removed.
>>
>> BTW, the syntax of ATS is heavily influenced by Standard ML.
>>
>> On Mon, Aug 3, 2020 at 10:21 AM Timmy Jose  wrote:
>>
>>>
>>> Hello,
>>>
>>> I've been trying to learn ATS from the official tutorials, and while I 
>>> like the language so far, and think that it is quite logical (if different 
>>> from many other languages in the same categories),  one thing that keeps 
>>> annoying me is getting some strange error messages.
>>>
>>> For instance, why is this a problem:
>>>
>>> fun
>>> bstree_search (
>>>   t0: bstree,
>>>   k0: string
>>> ): bool =
>>> case+ t0 of
>>>   | E () => false,
>>>   | B (t1, k, t2) => 
>>> let val sgn = compare (k0, k)
>>> in case+ 0 of
>>>   | _ when sgn < 0 => bstree_search (t1, k0)
>>>   | _ when sgn > 0 => bstree_search (t2, k0)
>>>   | _ => true
>>> end
>>>
>>> I would expect that the return types of all sub-expressions are `void` 
>>> anyway, so why does the compiler complain:
>>>
>>> $ patscc -DATS_MEMALLOC_LIBC -o bst bst.dats && ./bst
>>> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>>>  
>>> 1022(line=53, offs=22) -- 1023(line=53, offs=23): error(parsing): the token 
>>> is discarded.
>>> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>>>  
>>> 1096(line=56, offs=9) -- 1098(line=56, offs=11): error(parsing): the token 
>>> is discarded.
>>> exit(ATS): uncaught exception: 
>>> _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>>>
>>> The ATS FAQ recommends wrapping expressions with parentheses for such 
>>> errors, but doing so in this case does not get rid of the errors, and 
>>> secondly why is that even needed?
>>>
>>> Right now, this is the biggest thing that keeps tripping me up - 
>>> seemingly random "token discarded" error messages as well as some strange 
>>> "} keyword needed" error message etc. Experimenting randomly seems to fix 
>>> them most times, but is there any reason to this madness?
>>>
>>> Can anyone give me general guidelines to avoid seeing these sort of 
>>> trivial errors?
>>>
>>> Best,
>>>
>>> Timmy
>>>
>>> -- 
>>> 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.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/eaa5a4e2-a888-4ad4-aaeb-453c35aae698n%40googlegroups.com.


Re: error messages

2020-08-03 Thread Timmy Jose
Thank you! That solved the problem indeed. 

The error messages though were not very helpful here. I'm slowly building 
up an intuition on what might be wrong in my programs by encountering 
errors, but the error messages can definitely undergo a huger improvement! 
:-)

On Monday, August 3, 2020 at 8:13:45 PM UTC+5:30 gmhwxi wrote:

> There is a COMMA following 'false' that should be removed.
>
> BTW, the syntax of ATS is heavily influenced by Standard ML.
>
> On Mon, Aug 3, 2020 at 10:21 AM Timmy Jose  wrote:
>
>>
>> Hello,
>>
>> I've been trying to learn ATS from the official tutorials, and while I 
>> like the language so far, and think that it is quite logical (if different 
>> from many other languages in the same categories),  one thing that keeps 
>> annoying me is getting some strange error messages.
>>
>> For instance, why is this a problem:
>>
>> fun
>> bstree_search (
>>   t0: bstree,
>>   k0: string
>> ): bool =
>> case+ t0 of
>>   | E () => false,
>>   | B (t1, k, t2) => 
>> let val sgn = compare (k0, k)
>> in case+ 0 of
>>   | _ when sgn < 0 => bstree_search (t1, k0)
>>   | _ when sgn > 0 => bstree_search (t2, k0)
>>   | _ => true
>> end
>>
>> I would expect that the return types of all sub-expressions are `void` 
>> anyway, so why does the compiler complain:
>>
>> $ patscc -DATS_MEMALLOC_LIBC -o bst bst.dats && ./bst
>> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>>  
>> 1022(line=53, offs=22) -- 1023(line=53, offs=23): error(parsing): the token 
>> is discarded.
>> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>>  
>> 1096(line=56, offs=9) -- 1098(line=56, offs=11): error(parsing): the token 
>> is discarded.
>> exit(ATS): uncaught exception: 
>> _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>>
>> The ATS FAQ recommends wrapping expressions with parentheses for such 
>> errors, but doing so in this case does not get rid of the errors, and 
>> secondly why is that even needed?
>>
>> Right now, this is the biggest thing that keeps tripping me up - 
>> seemingly random "token discarded" error messages as well as some strange 
>> "} keyword needed" error message etc. Experimenting randomly seems to fix 
>> them most times, but is there any reason to this madness?
>>
>> Can anyone give me general guidelines to avoid seeing these sort of 
>> trivial errors?
>>
>> Best,
>>
>> Timmy
>>
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/5162ebd4-cff4-4e7a-a8f8-512b30e8164en%40googlegroups.com.


Re: error messages

2020-08-03 Thread Hongwei Xi
By the way, an ifcase-expression should be used in place of the
case-expression
in your code. Also, I would like to point out that templates are a shining
feature of ATS :)

##

datatype
bstree(a:t@ype) =
| E of ()
| B of (bstree(a), a, bstree(a))

fun
{a:t@ype}
bstree_search
(
 t0: bstree(a),
 k0: a
) : bool =
case+ t0 of
| E () => false
| B (t1, k, t2) =>
  let
  val sgn =
  gcompare_val_val(k0, k)
  in
  ifcase
  | sgn < 0 => bstree_search (t1, k0)
  | sgn > 0 => bstree_search (t2, k0)
  | _ (* else *) => true
  end


On Mon, Aug 3, 2020 at 10:43 AM Hongwei Xi  wrote:

> There is a COMMA following 'false' that should be removed.
>
> BTW, the syntax of ATS is heavily influenced by Standard ML.
>
> On Mon, Aug 3, 2020 at 10:21 AM Timmy Jose  wrote:
>
>>
>> Hello,
>>
>> I've been trying to learn ATS from the official tutorials, and while I
>> like the language so far, and think that it is quite logical (if different
>> from many other languages in the same categories),  one thing that keeps
>> annoying me is getting some strange error messages.
>>
>> For instance, why is this a problem:
>>
>> fun
>> bstree_search (
>>   t0: bstree,
>>   k0: string
>> ): bool =
>> case+ t0 of
>>   | E () => false,
>>   | B (t1, k, t2) =>
>> let val sgn = compare (k0, k)
>> in case+ 0 of
>>   | _ when sgn < 0 => bstree_search (t1, k0)
>>   | _ when sgn > 0 => bstree_search (t2, k0)
>>   | _ => true
>> end
>>
>> I would expect that the return types of all sub-expressions are `void`
>> anyway, so why does the compiler complain:
>>
>> $ patscc -DATS_MEMALLOC_LIBC -o bst bst.dats && ./bst
>> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>> 1022(line=53, offs=22) -- 1023(line=53, offs=23): error(parsing): the token
>> is discarded.
>> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>> 1096(line=56, offs=9) -- 1098(line=56, offs=11): error(parsing): the token
>> is discarded.
>> exit(ATS): uncaught exception:
>> _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>>
>> The ATS FAQ recommends wrapping expressions with parentheses for such
>> errors, but doing so in this case does not get rid of the errors, and
>> secondly why is that even needed?
>>
>> Right now, this is the biggest thing that keeps tripping me up -
>> seemingly random "token discarded" error messages as well as some strange
>> "} keyword needed" error message etc. Experimenting randomly seems to fix
>> them most times, but is there any reason to this madness?
>>
>> Can anyone give me general guidelines to avoid seeing these sort of
>> trivial errors?
>>
>> Best,
>>
>> Timmy
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com
>> <https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLp869w2YMiaheMAranfUTk2s4ei9sdC_Y9zDvaRN1374Q%40mail.gmail.com.


Re: error messages

2020-08-03 Thread Hongwei Xi
There is a COMMA following 'false' that should be removed.

BTW, the syntax of ATS is heavily influenced by Standard ML.

On Mon, Aug 3, 2020 at 10:21 AM Timmy Jose  wrote:

>
> Hello,
>
> I've been trying to learn ATS from the official tutorials, and while I
> like the language so far, and think that it is quite logical (if different
> from many other languages in the same categories),  one thing that keeps
> annoying me is getting some strange error messages.
>
> For instance, why is this a problem:
>
> fun
> bstree_search (
>   t0: bstree,
>   k0: string
> ): bool =
> case+ t0 of
>   | E () => false,
>   | B (t1, k, t2) =>
> let val sgn = compare (k0, k)
> in case+ 0 of
>   | _ when sgn < 0 => bstree_search (t1, k0)
>   | _ when sgn > 0 => bstree_search (t2, k0)
>   | _ => true
> end
>
> I would expect that the return types of all sub-expressions are `void`
> anyway, so why does the compiler complain:
>
> $ patscc -DATS_MEMALLOC_LIBC -o bst bst.dats && ./bst
> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
> 1022(line=53, offs=22) -- 1023(line=53, offs=23): error(parsing): the token
> is discarded.
> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
> 1096(line=56, offs=9) -- 1098(line=56, offs=11): error(parsing): the token
> is discarded.
> exit(ATS): uncaught exception:
> _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>
> The ATS FAQ recommends wrapping expressions with parentheses for such
> errors, but doing so in this case does not get rid of the errors, and
> secondly why is that even needed?
>
> Right now, this is the biggest thing that keeps tripping me up - seemingly
> random "token discarded" error messages as well as some strange "} keyword
> needed" error message etc. Experimenting randomly seems to fix them most
> times, but is there any reason to this madness?
>
> Can anyone give me general guidelines to avoid seeing these sort of
> trivial errors?
>
> Best,
>
> Timmy
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com
> <https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLqp1V-Su-LrsP5nuoaGcFjYTLn%2B2zswKztYtexFdtdNQQ%40mail.gmail.com.


Re: error messages

2020-08-03 Thread Timmy Jose
I meant `bool` instead of `void`.

On Monday, August 3, 2020 at 7:51:51 PM UTC+5:30 Timmy Jose wrote:

>
> Hello,
>
> I've been trying to learn ATS from the official tutorials, and while I 
> like the language so far, and think that it is quite logical (if different 
> from many other languages in the same categories),  one thing that keeps 
> annoying me is getting some strange error messages.
>
> For instance, why is this a problem:
>
> fun
> bstree_search (
>   t0: bstree,
>   k0: string
> ): bool =
> case+ t0 of
>   | E () => false,
>   | B (t1, k, t2) => 
> let val sgn = compare (k0, k)
> in case+ 0 of
>   | _ when sgn < 0 => bstree_search (t1, k0)
>   | _ when sgn > 0 => bstree_search (t2, k0)
>   | _ => true
> end
>
> I would expect that the return types of all sub-expressions are `void` 
> anyway, so why does the compiler complain:
>
> $ patscc -DATS_MEMALLOC_LIBC -o bst bst.dats && ./bst
> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>  
> 1022(line=53, offs=22) -- 1023(line=53, offs=23): error(parsing): the token 
> is discarded.
> /Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
>  
> 1096(line=56, offs=9) -- 1098(line=56, offs=11): error(parsing): the token 
> is discarded.
> exit(ATS): uncaught exception: 
> _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>
> The ATS FAQ recommends wrapping expressions with parentheses for such 
> errors, but doing so in this case does not get rid of the errors, and 
> secondly why is that even needed?
>
> Right now, this is the biggest thing that keeps tripping me up - seemingly 
> random "token discarded" error messages as well as some strange "} keyword 
> needed" error message etc. Experimenting randomly seems to fix them most 
> times, but is there any reason to this madness?
>
> Can anyone give me general guidelines to avoid seeing these sort of 
> trivial errors?
>
> Best,
>
> Timmy
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/1c696dbd-6963-4af7-81ec-be6854d0a077n%40googlegroups.com.


Re: error messages

2020-08-03 Thread Timmy Jose

Hello,

I've been trying to learn ATS from the official tutorials, and while I like 
the language so far, and think that it is quite logical (if different from 
many other languages in the same categories),  one thing that keeps 
annoying me is getting some strange error messages.

For instance, why is this a problem:

fun
bstree_search (
  t0: bstree,
  k0: string
): bool =
case+ t0 of
  | E () => false,
  | B (t1, k, t2) => 
let val sgn = compare (k0, k)
in case+ 0 of
  | _ when sgn < 0 => bstree_search (t1, k0)
  | _ when sgn > 0 => bstree_search (t2, k0)
  | _ => true
end

I would expect that the return types of all sub-expressions are `void` 
anyway, so why does the compiler complain:

$ patscc -DATS_MEMALLOC_LIBC -o bst bst.dats && ./bst
/Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
 
1022(line=53, offs=22) -- 1023(line=53, offs=23): error(parsing): the token 
is discarded.
/Users/z0ltan/dev/study/ats/introduction_to_programming_in_ats/chapter4/bst.dats:
 
1096(line=56, offs=9) -- 1098(line=56, offs=11): error(parsing): the token 
is discarded.
exit(ATS): uncaught exception: 
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)

The ATS FAQ recommends wrapping expressions with parentheses for such 
errors, but doing so in this case does not get rid of the errors, and 
secondly why is that even needed?

Right now, this is the biggest thing that keeps tripping me up - seemingly 
random "token discarded" error messages as well as some strange "} keyword 
needed" error message etc. Experimenting randomly seems to fix them most 
times, but is there any reason to this madness?

Can anyone give me general guidelines to avoid seeing these sort of trivial 
errors?

Best,

Timmy

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/71b5daaa-c80b-42d6-983a-72d8ab59b0ean%40googlegroups.com.