Unit and Void types in ATS3

55 views
Skip to first unread message

rodol

unread,
Dec 11, 2019, 5:16:43 AM12/11/19
to ats-lang-users
So I was reading category theory, and it talked about initial object and the terminal object. In haskell, () is the unit, so it was the first thing I tried in ATS Postiats.

val unit = ()
implement main0 () = ()

Awesome, that compiles. So I tried putting the unit in a tuple, just for testing:

val unit = ()
val tuple = (1, unit)
implement main0 () = ()

It doesn't compile, saying

error: field has incomplete type 'atsvoid_t0ype' (aka 'void')

I searched a bit here, and found this had been talked about.

So the question is, since this is a limitation coming from C, will this be able to change in ATS3 since it will use LLVM?

gmhwxi

unread,
Dec 11, 2019, 11:48:55 AM12/11/19
to ats-lang-users

Yes, I hope to resolve the issue in ATS3.

Richard

unread,
Dec 11, 2019, 6:21:54 PM12/11/19
to ats-lang-users
Though, this should compile correctly,

val unit = unit()

val tuple
= (1, unit)
implement main0
() = ()

On Wednesday, December 11, 2019 at 5:16:43 AM UTC-5, rodol wrote:
Reply all
Reply to author
Forward
0 new messages