In haskell one can use (show x) to convert x to string , provided that x is
showable and new datatypes can implement show for converting values of that
type to string.
Is there already some thing like show in ATS that can use to convert
to string from integer , char , bool and other types.
I added tostring.sats and tostring.dats into ATSLIB/prelude:
This will be made available in the next release.
In general, a tostring_* function is based on its corresponding tostrptr_*
function; the latter
returns a linear string that can be freed after its use.
Main purpose is to have a documented uniform interface for common tasks
like for converting values to string , reading values from string and
others.
It is not like that you cannot do Haskell style of programming in ATS.
However, you
can quickly feel that such a style of programming done in ATS is rather
wasteful.
Okay
On Saturday, April 4, 2015 at 11:11:02 PM UTC+5:30, gmhwxi wrote:
As of now, the primary way to “show” a value in ATS is to call some
kind of ‘fprint’ function.
‘show’ in Haskell sounds like a misnomer; it should really be called
‘toString’.
There is a tostring (not toString) function for bool and another for
char. I can gradually
add such functions for other common types.
It is not like that you cannot do Haskell style of programming in ATS.
However, you
can quickly feel that such a style of programming done in ATS is rather
wasteful.
On Saturday, April 4, 2015 at 10:27:28 AM UTC-4, Chotu S wrote:
In haskell one can use (show x) to convert x to string , provided that x
is showable and new datatypes can implement show for converting values of
that type to string.
Is there already some thing like show in ATS that can use to
convert to string from integer , char , bool and other types.
The kind of polymorphism involved in tostring_val is often referred to as
ad-hoc polymorphism
(in contrast to parametric polymorphism).On Wed, Apr 8, 2015 at 12:24 PM, ‘Yannick Duchêne’ via ats-lang-users < ats-lan...@googlegroups.com> wrote:
Le dimanche 5 avril 2015 22:20:59 UTC+2, gmhwxi a écrit :
Main purpose is to have a documented uniform interface for common tasks
like for converting values to string , reading values from string and
others.
It is not like that you cannot do Haskell style of programming in ATS.
However, you
can quickly feel that such a style of programming done in ATS is rather
wasteful.
Okay :-)On Saturday, April 4, 2015 at 11:11:02 PM UTC+5:30, gmhwxi wrote:
As of now, the primary way to “show” a value in ATS is to call some
kind of ‘fprint’ function.
‘show’ in Haskell sounds like a misnomer; it should really be called
‘toString’.
There is a tostring (not toString) function for bool and another for char.
I can gradually
add such functions for other common types.
It is not like that you cannot do Haskell style of programming in ATS.
However, you
can quickly feel that such a style of programming done in ATS is rather
wasteful.
On Saturday, April 4, 2015 at 10:27:28 AM UTC-4, Chotu S wrote:
In haskell one can use (show x) to convert x to string , provided that x
is showable and new datatypes can implement show for converting values of
that type to string.
Is there already some thing like show in ATS that can use to
convert to string from integer , char , bool and other types.
As of now, the primary way to “show” a value in ATS is to call some
kind of ‘fprint’ function.
‘show’ in Haskell sounds like a misnomer; it should really be called
‘toString’.
There is a tostring (not toString) function for bool and another for char.
I can gradually
add such functions for other common types.
It is not like that you cannot do Haskell style of programming in ATS.
However, you
can quickly feel that such a style of programming done in ATS is rather
wasteful.On Saturday, April 4, 2015 at 10:27:28 AM UTC-4, Chotu S wrote:
In haskell one can use (show x) to convert x to string , provided that x
is showable and new datatypes can implement show for converting values of
that type to string.
Is there already some thing like show in ATS that can use to
convert to string from integer , char , bool and other types.