Type system woes.

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Type system woes.

laurence taylor
The type :

where Arrow could be a Function
Arrow : <Inpt,Outpt>
P1        : parameter one type.
P2        : parameter two type.
R          : return type.
t[n]        : tuple access

Arrow< Tuple2<P1,P2> , Tuple2<P1,R> >

          ____ f( t[0] )____
p1 __/                            \___R
p2 ____________________P2

works fine, but

Arrow< Tuple2<P1,P2>, Tuple2<R,P2> >

P1 ____________________P1
p2 __                             ____R
         \____f( t[1] )____/

does not, throwing a type error.

I've got a number of errors like this, and I'm sure they are logically correct. 

Is this a bug? is it known? can it be fixed?

regards,
Laurence

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

laurence taylor
Sorry, graphics are reversed.

On Tue, Sep 13, 2011 at 10:11 AM, Laurence Taylor <[hidden email]> wrote:
The type :

where Arrow could be a Function
Arrow : <Inpt,Outpt>
P1        : parameter one type.
P2        : parameter two type.
R          : return type.
t[n]        : tuple access

Arrow< Tuple2<P1,P2> , Tuple2<P1,R> >

          ____ f( t[0] )____
p1 __/                            \___R
p2 ____________________P2

works fine, but

Arrow< Tuple2<P1,P2>, Tuple2<R,P2> >

P1 ____________________P1
p2 __                             ____R
         \____f( t[1] )____/

does not, throwing a type error.

I've got a number of errors like this, and I'm sure they are logically correct. 

Is this a bug? is it known? can it be fixed?

regards,
Laurence


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

sledorze
In reply to this post by laurence taylor
should be Arrow< Tuple2<P1,P2>, Tuple2<P1,R> >
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

sledorze
In reply to this post by laurence taylor
I think you better create a small snippet revealing the error; as it's difficult to see the error..
I did not have issue like this in my own arrow implementation..


On Tue, Sep 13, 2011 at 10:16 AM, laurence taylor [via Haxe] <[hidden email]> wrote:
Sorry, graphics are reversed.

On Tue, Sep 13, 2011 at 10:11 AM, Laurence Taylor <[hidden email]> wrote:
The type :

where Arrow could be a Function
Arrow : <Inpt,Outpt>
P1        : parameter one type.
P2        : parameter two type.
R          : return type.
t[n]        : tuple access

Arrow< Tuple2<P1,P2> , Tuple2<P1,R> >

          ____ f( t[0] )____
p1 __/                            \___R
p2 ____________________P2

works fine, but

Arrow< Tuple2<P1,P2>, Tuple2<R,P2> >

P1 ____________________P1
p2 __                             ____R
         \____f( t[1] )____/

does not, throwing a type error.

I've got a number of errors like this, and I'm sure they are logically correct. 

Is this a bug? is it known? can it be fixed?

regards,
Laurence


--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Type-system-woes-tp6786613p6786621.html
To unsubscribe from Type system woes., click here.



--
Stéphane Le Dorze


Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

laurence taylor
(*tldr: It looks like the type parameter from the function then doesn’t know that it should populate the type parameter in the constructor function of Then)

No, there is definitely something different about the way the type system resolves the type parameters of a second function parameter, even if I can't quite put my finger on in.

Arrows are defined:

Arrow<P,R>

like functions of one parameter.
Product is defined:

Arrow< Tuple2<P1,R1>, Tuple2<P2,R2>>;

which, as you know takes a Tuple and applies f to t[0] and g to t[1], yielding

Tuple<R1,R2>

now,
First is descended from Product where

P2 == R2;

(first calls a function/arrow on the first element of the Tuple ( t[0] ))
so:

Arrow< Tuple2<P1,R1> , Tuple2<P2,P2> >;

which causes the type system no problems, but
Second (calling a function on the *second* element ( t[1] ) ), where

P1 == R1

Arrow<Tuple2<P1,P1>,Tuple2<P2,R2>>

causes problems.
Right now, the same goes for Then.

P1->R1 then R1->R2 => P1->R2

leads to:

src/arrow/Viaz.hx:100: characters 26-31 : arrow.Arrow<arrow.Viaz.AR, then.R1> should be arrow.Viaz<arrow.Viaz.AR, Unknown<0>>

where:

public function then<R1>(r:Arrow<R,R1>):Arrow<P,R1>;

Then is:
class Compose<AP1,AR1,AR2>
which extends Composition:

Composition<AP1,AR1,AP2,AR2> extends Viaz<AP1,AR2>

so the leftmost AP1 and the rightmost AR2 become the input/output types of the Arrow,
and Compose, because the input of g is the output of f:

Composition<AP1,AR1,AR1,AR2>


I'm pretty unclear about what's going wrong.

regards,
Laurence

On Tue, Sep 13, 2011 at 10:29 AM, sledorze <[hidden email]> wrote:
I think you better create a small snippet revealing the error; as it's difficult to see the error..
I did not have issue like this in my own arrow implementation..


On Tue, Sep 13, 2011 at 10:16 AM, laurence taylor [via Haxe] <[hidden email]> wrote:
Sorry, graphics are reversed.


On Tue, Sep 13, 2011 at 10:11 AM, Laurence Taylor <[hidden email]> wrote:
The type :

where Arrow could be a Function
Arrow : <Inpt,Outpt>
P1        : parameter one type.
P2        : parameter two type.
R          : return type.
t[n]        : tuple access

Arrow< Tuple2<P1,P2> , Tuple2<P1,R> >

          ____ f( t[0] )____
p1 __/                            \___R
p2 ____________________P2

works fine, but

Arrow< Tuple2<P1,P2>, Tuple2<R,P2> >

P1 ____________________P1
p2 __                             ____R
         \____f( t[1] )____/

does not, throwing a type error.

I've got a number of errors like this, and I'm sure they are logically correct. 

Is this a bug? is it known? can it be fixed?

regards,
Laurence


--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/Type-system-woes-tp6786613p6786621.html
To unsubscribe from Type system woes., click here.



--
Stéphane Le Dorze


Tel: <a href="tel:%2B33%20%280%29%206%2008%20%C2%A076%2070%2015" value="+33608767015" target="_blank">+33 (0) 6 08  76 70 15




View this message in context: Re: Type system woes.

Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

sledorze
I'm sorry but, I guess your Arrow type should be:

Arrow< Tuple2<P1, P2>, Tuple2<R1, R2> >

This is not related to your typing issue but to Arrows, however your problem may not exist with this corrected signature..

Hope it will help fixing it!

Stephane

P.S.: I find easier to reason on code rather an interpretation of it without seeing it..
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

bubblebenj
About of subject : Am i the only one that see escaped characters "&gt;" and "&lt;" instead of ">" and "<" in stephane's mail ?

Sorry for that.

Btw, if you guys have the ability to use a monospaced font (courier, terminal...) for code parts please use it (especially for large parts), I'm confident I'm not the only one that appreciate it.

Ben

On Tue, Sep 13, 2011 at 2:14 PM, sledorze <[hidden email]> wrote:
I'm sorry but, I guess your Arrow type should be:

Arrow< Tuple2&lt;P1, P2&gt;, Tuple2&lt;R1, R2&gt; >

This is not related to your typing issue but to Arrows, however your problem
may not exist with this corrected signature..

Hope it will help fixing it!

Stephane

P.S.: I find easier to reason on code rather an interpretation of it without
seeing it..


--
View this message in context: http://haxe.1354130.n2.nabble.com/Type-system-woes-tp6786613p6787218.html
Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

laurence taylor
@ben Duly noted, and yeah, I saw the escaped characters too. 

@sledorze My fault, I had screwed up the Typing.

thanks,
Laurence
On Tue, Sep 13, 2011 at 2:49 PM, benjamin Dubois <[hidden email]> wrote:
About of subject : Am i the only one that see escaped characters "&gt;" and "&lt;" instead of ">" and "<" in stephane's mail ?

Sorry for that.

Btw, if you guys have the ability to use a monospaced font (courier, terminal...) for code parts please use it (especially for large parts), I'm confident I'm not the only one that appreciate it.

Ben


On Tue, Sep 13, 2011 at 2:14 PM, sledorze <[hidden email]> wrote:
I'm sorry but, I guess your Arrow type should be:

Arrow< Tuple2&lt;P1, P2&gt;, Tuple2&lt;R1, R2&gt; >

This is not related to your typing issue but to Arrows, however your problem
may not exist with this corrected signature..

Hope it will help fixing it!

Stephane

P.S.: I find easier to reason on code rather an interpretation of it without
seeing it..


--
View this message in context: http://haxe.1354130.n2.nabble.com/Type-system-woes-tp6786613p6787218.html
Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

Johann Borck
In reply to this post by laurence taylor
On 09/13/2011 12:44 PM, Laurence Taylor wrote:
(*tldr: It looks like the type parameter from the function then doesn’t know that it should populate the type parameter in the constructor function of Then)


No, there is definitely something different about the way the type system resolves the type parameters of a second function parameter, even if I can't quite put my finger on in.

Please make example code available that reproduces the problem (see http://sscce.org/ ). Especially in this case, where you suspect a bug in a core component of the compiler. Please.

regards, Johann

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type system woes.

laurence taylor
I will, just as soon as I catch that damn bug. 

I don't fully understand type systems or their components, and until I do I don't know what variables to modulate, and the whole thing becomes a time sink. Sorry to offend your eyeballs, but when I have a full understanding of a bug I file a bug report. Thankyou.

regards
Laurence

On Tue, Sep 13, 2011 at 4:57 PM, Johann Borck <[hidden email]> wrote:
On 09/13/2011 12:44 PM, Laurence Taylor wrote:
(*tldr: It looks like the type parameter from the function then doesn’t know that it should populate the type parameter in the constructor function of Then)


No, there is definitely something different about the way the type system resolves the type parameters of a second function parameter, even if I can't quite put my finger on in.

Please make example code available that reproduces the problem (see http://sscce.org/ ). Especially in this case, where you suspect a bug in a core component of the compiler. Please.

regards, Johann

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org