Re: Template-based implementation for functors

2018-05-02 Thread gmhwxi
I am a bit surprised. It did not work. It works now because of a recent change I made on checking type equality (my guess). On Wednesday, May 2, 2018 at 12:17:26 AM UTC-4, Steinway Wu wrote: > > I actually just tried it, and it works with `[n:nat] List (a, n)`. See > https://glot.io/snippets/f0n

Re: Template-based implementation for functors

2018-05-01 Thread Steinway Wu
I actually just tried it, and it works with `[n:nat] List (a, n)`. See https://glot.io/snippets/f0nf39m7lk. On Tuesday, May 1, 2018 at 11:59:32 PM UTC-4, Steinway Wu wrote: > > Oh I see. But anyway, here's a monad type class. Just for the record. > > https://glot.io/snippets/f0nejek645 > > > On

Re: Template-based implementation for functors

2018-05-01 Thread Steinway Wu
Oh I see. But anyway, here's a monad type class. Just for the record. https://glot.io/snippets/f0nejek645 On Tuesday, May 1, 2018 at 11:27:29 PM UTC-4, gmhwxi wrote: > > > This approach can only handle simple type constructors like list and maybe. > It would not handle List defined as follows:

Re: Template-based implementation for functors

2018-05-01 Thread Hongwei Xi
wrote: >> >> >> If we box everything, then implementing functors (as is defined in >> Haskell) is straightforward >> in ATS. However, for performance, one may not want to box everything. I >> sketched a template-based >> implementation for functors as follows:

Re: Template-based implementation for functors

2018-05-01 Thread Steinway Wu
h 29, 2017 at 10:38:00 AM UTC-4, gmhwxi wrote: > > > If we box everything, then implementing functors (as is defined in > Haskell) is straightforward > in ATS. However, for performance, one may not want to box everything. I > sketched a template-based > implementation for f

Fwd: Template-based implementation for functors

2017-04-05 Thread Hongwei Xi
If you use t0ype, the compiler cannot figure out the size of r, causing a compilation error. Sent from my T-Mobile 4G LTE device -- Original message-- *From: *August Alm *Date: *Wed, Apr 5, 2017 3:18 PM *To: *ats-lang-users; *Subject:*Re: Template-based implementation for functors

Re: Template-based implementation for functors

2017-04-05 Thread August Alm
gt;>>>>>>> >>>>>>>>>>> When mapM_list_vt$aux is compiled. {m:fvtype} is not >>>>>>>>>>> instantiated. >>>>>>>>>>> Only template parameters are instantiated. This is a big

Re: Template-based implementation for functors

2017-04-05 Thread Hongwei Xi
>>>>>>>> incorrect. >>>>>>>>>>> The code should have compiled. I will see if I can figure out >>>>>>>>>>> the cause for this bug. >>>>>>>>>>> >>>>>>>>>>>

Re: Template-based implementation for functors

2017-04-05 Thread August Alm
gt;>> let implement mapM_list_vt$fopr(x) = fopr(x) >>>>>>>>>>> in mapM_list_vt$aux{m}{n}(pfm| xs) end >>>>>>>>>>> >>>>>>>>>>> So the implementation of mapM_list_vt$fopr cannot be used for >>>>>&g

Re: Template-based implementation for functors

2017-04-03 Thread gmhwxi
gt; >>>>>>>>>>> Great! But ...What just happened, what's the lesson I should >>>>>>>>>>> take away? >>>>>>>>>>> >>>>>>>>>&

Re: Template-based implementation for functors

2017-04-03 Thread August Alm
ou change the body of mapM_list_vt_fun as follows: >>>>>>>>>>> >>>>>>>>>>> let >>>>>>>>>>> implement(a,s) >>>>>>>>>>

Re: Template-based implementation for functors

2017-04-03 Thread gmhwxi
>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Thu, Mar 30, 2017 at 5:11 PM, August Alm >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>>> I think the

Re: Template-based implementation for functors

2017-04-03 Thread gmhwxi
t;>>>>>>>> >>>>>>>>>> or >>>>>>>>>> >>>>>>>>>> extern fun{m_name: type}{a, b: vt0ype} >>>>>>>>>> {m: fvtype} >>>>>>>>>> mapM_list_vt$fopr(MON

Re: Template-based implementation for functors

2017-04-03 Thread gmhwxi
> Is there a way to coerce the typechecking in situations like this? >>>>>>>>> >>>>>>>>> Best, >>>>>>>>> August >>>>>>>>> >>>>>>>>> Den torsdag 30 mars 2017 kl. 18:

Re: Template-based implementation for functors

2017-04-03 Thread August Alm
se: >>>>>>>>> >>>>>>>>> val xs: list_vt(int_vt, 3) = $list_vt(I(1), I(2), I(3)) >>>>>>>>> >>>>>>>>> changes to >>>>>>>>> >>>>>>>>> val xs =

Re: Template-based implementation for functors

2017-04-02 Thread August Alm
>>>> val xs: list_vt(int_vt, 3) = $list_vt(I(1), I(2), I(3)) >>>>>>>>> >>>>>>>>> changes to >>>>>>>>> >>>>>>>>> val xs = $list_vt{int_vt}(I(1), I(2), I(3)) >>>>>>>>> >>&

Re: Template-based implementation for functors

2017-04-02 Thread gmhwxi
hing could remove the need >>>>>>>>>>> for the user to explicitly define "extern praxis FUNCTOR_f_elim" >>>>>>>>>>> and >>>>>>>>>>> "abstype f_name" for each functo

Re: Template-based implementation for functors

2017-04-02 Thread August Alm
gt;>>> >>>>>>>>> Something can definitely done along this line. At some point in >>>>>>>>> the past, >>>>>>>>> I was even contemplating some kind of support for automatically >>>>>>>>>

Re: Template-based implementation for functors

2017-04-01 Thread August Alm
t;>> https://glot.io/snippets/eoh28sd2p4 >>>>>>>>>> >>>>>>>>>> Den torsdag 30 mars 2017 kl. 15:54:08 UTC+2 skrev gmhwxi: >>>>>>>>>>> >>>>>>>>>>> I see. Maybe a clever macro or

Re: Template-based implementation for functors

2017-04-01 Thread August Alm
omething could remove the need >>>>>>>>>>> for the user to explicitly define "extern praxis FUNCTOR_f_elim" >>>>>>>>>>> and >>>>>>>>>>> "abstype f_name" for each functor ins

Re: Template-based implementation for functors

2017-03-31 Thread gmhwxi
gt;>>>> >>>>>>>>> >>>>>>>>> Something can definitely done along this line. At some point in >>>>>>>>> the past, >>>>>>>>> I was even contemplating some kind of support for automati

Re: Template-based implementation for functors

2017-03-31 Thread gmhwxi
d right away because I wanted to see more use >>>>>>>> cases involving >>>>>>>> concepts from category theory. >>>>>>>> >>>>>>>> On Thursday, March 30, 2017 at 4:37:47 AM UTC-4, August Alm wrote: >

Re: Template-based implementation for functors

2017-03-31 Thread gmhwxi
t; cases involving >>>>>>> concepts from category theory. >>>>>>> >>>>>>> On Thursday, March 30, 2017 at 4:37:47 AM UTC-4, August Alm wrote: >>>>>>>> >>>>>>>> Den torsdag 30 mars 2017

Re: Template-based implementation for functors

2017-03-31 Thread August Alm
gt; synthesizing >>>>>>>> proofs of certain props. Kind of like inferring dictionaries for >>>>>>>> type classes. >>>>>>>> >>>>>>>> I did not go forward right away because I wanted to see more use >

Re: Template-based implementation for functors

2017-03-30 Thread gmhwxi
t; >>>>>>> On Thursday, March 30, 2017 at 4:37:47 AM UTC-4, August Alm wrote: >>>>>>>> >>>>>>>> Den torsdag 30 mars 2017 kl. 04:22:08 UTC+2 skrev gmhwxi: >>>>>>>> > Unfortunately, using a type functio

Re: Template-based implementation for functors

2017-03-30 Thread gmhwxi
t;> I did not go forward right away because I wanted to see more use >>>>>>> cases involving >>>>>>> concepts from category theory. >>>>>>> >>>>>>> On Thursday, March 30, 2017 at 4:37:47 AM UTC-4, August Alm

Re: Template-based implementation for functors

2017-03-30 Thread August Alm
AM UTC-4, August Alm wrote: >>>>>>> >>>>>>> Den torsdag 30 mars 2017 kl. 04:22:08 UTC+2 skrev gmhwxi: >>>>>>> > Unfortunately, using a type function (of the sort ftype or fvtype) >>>>>>> as a >>>>

Re: Template-based implementation for functors

2017-03-30 Thread gmhwxi
>>>>> > Unfortunately, using a type function (of the sort ftype or fvtype) >>>>>>> as a >>>>>>> > template argument is currently not supported. That is why I used a >>>>>>> "name" >>>>>>

Re: Template-based implementation for functors

2017-03-30 Thread August Alm
https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/MISC/tempfunctor.dats >>>>>> > >>>>>> > On Wednesday, March 29, 2017 at 6:36:02 PM UTC-4, August Alm wrote: >>>>>> > For fun and learning I tried to do linear monads in a similar >

Re: Template-based implementation for functors

2017-03-30 Thread Hongwei Xi
>>>>> > On Wednesday, March 29, 2017 at 6:36:02 PM UTC-4, August Alm wrote: >>>>> > For fun and learning I tried to do linear monads in a similar >>>>> spirit, see: https://glot.io/snippets/eogc8rdiv1 I get the code >>>>> > to compile (wi

Re: Template-based implementation for functors

2017-03-30 Thread August Alm
gt; out; don't know what's wrong with that) >>>> > but it does not run on glot.io, because of LIBATS/ML-dependency and >>>> (I think) unboxed types. My take >>>> > does not involve "name-types", just abstract proofs that an [m: >&g

Re: Template-based implementation for functors

2017-03-30 Thread gmhwxi
g with that) >>> > but it does not run on glot.io, because of LIBATS/ML-dependency and >>> (I think) unboxed types. My take >>> > does not involve "name-types", just abstract proofs that an [m: vt0ype >>> -> vtype] is a monad. >>> >

Re: Template-based implementation for functors

2017-03-30 Thread August Alm
I >> think) unboxed types. My take >> > does not involve "name-types", just abstract proofs that an [m: vt0ype >> -> vtype] is a monad. >> > >> > Den onsdag 29 mars 2017 kl. 16:38:00 UTC+2 skrev gmhwxi: >> > >> > If we box everythin

Re: Template-based implementation for functors

2017-03-30 Thread August Alm
run on glot.io, because of LIBATS/ML-dependency and (I >> think) unboxed types. My take >> > does not involve "name-types", just abstract proofs that an [m: vt0ype >> -> vtype] is a monad. >> > >> > Den onsdag 29 mars 2017 kl. 16:38:00 UTC+2 skre

Re: Template-based implementation for functors

2017-03-30 Thread gmhwxi
then implementing functors (as is defined in > Haskell) is straightforward > > in ATS. However, for performance, one may not want to box everything. I > sketched a template-based > > implementation for functors as follows: > > > > > https://github.com/githwxi/ATS-P

Re: Template-based implementation for functors

2017-03-30 Thread August Alm
abstract proofs that an [m: vt0ype -> > vtype] is a monad. > > Den onsdag 29 mars 2017 kl. 16:38:00 UTC+2 skrev gmhwxi: > > If we box everything, then implementing functors (as is defined in Haskell) > is straightforward > in ATS. However, for performance, one ma

Re: Template-based implementation for functors

2017-03-29 Thread gmhwxi
onsdag 29 mars 2017 kl. 16:38:00 UTC+2 skrev gmhwxi: >> >> >> If we box everything, then implementing functors (as is defined in >> Haskell) is straightforward >> in ATS. However, for performance, one may not want to box everything. I >> sketched a template-based

Re: Template-based implementation for functors

2017-03-29 Thread August Alm
ned in > Haskell) is straightforward > in ATS. However, for performance, one may not want to box everything. I > sketched a template-based > implementation for functors as follows: > > > https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/MISC/tempfunctor.dats >

Re: Template-based implementation for functors

2017-03-29 Thread August Alm
nsdag 29 mars 2017 kl. 16:38:00 UTC+2 skrev gmhwxi: >> >> >> If we box everything, then implementing functors (as is defined in >> Haskell) is straightforward >> in ATS. However, for performance, one may not want to box everything. I >> sketched a template-based >

Re: Template-based implementation for functors

2017-03-29 Thread August Alm
? Den onsdag 29 mars 2017 kl. 16:38:00 UTC+2 skrev gmhwxi: > > > If we box everything, then implementing functors (as is defined in > Haskell) is straightforward > in ATS. However, for performance, one may not want to box everything. I > sketched a template-based > impl

Template-based implementation for functors

2017-03-29 Thread gmhwxi
If we box everything, then implementing functors (as is defined in Haskell) is straightforward in ATS. However, for performance, one may not want to box everything. I sketched a template-based implementation for functors as follows: https://github.com/githwxi/ATS-Postiats/blob/master/doc