[clean-list] Derived type invalid?

Diederik van Arkel dvanarkel at mac.com
Sat Nov 26 18:25:49 MET 2005


On Nov 26, 2005, at 3:01 AM, clean-list.mail.zooloo at xoxy.net wrote:

> Hi all,
>
>
> when I give zeroes2 a type as follows:
>
> zeroes1 :: .{#a} | zero a & Array {#} a
> zeroes1 = {zero \\ i<-[0..w_1]}
>
> zeroes2 :: u:{#v:(a b)} | zero b & Array {#} (a b) & Array a b, [u <= 
> v]
> zeroes2 = {zeroes1 \\ i<-[0..h_1]}
>
>
> Clean 2.1.1 complains:
> Type error [...,zeroes2]: derived type u:{#v:{#a}} | zero a & Array 
> {#} {#a}
> & Array {#} a, [u <= v] conflicts with specified type u:{#v:(a b)} | 
> zero b
> & Array {#} (a b) & Array a b, [u <= v]
>
>
>
> However, using the derived type, i. e.
> zeroes2 :: u:{#v:{#a}} | zero a & Array {#} {#a} & Array {#} a, [u <= 
> v]
>
>
> results in
> Error [...,zeroes2]: ArrayM:16 type context should contain one or more 
> type
> variables

This is trying to tell you that you have a pointless context 
restriction, in
this case Array {#} {#a}. Note that the context resolver doesn't need 
to look
at the a in order to resolve this constraint, hence the peculiar error 
message
(I guess). So the simplified type:

zeroes2 :: u:{# v:{#b}}	| zero b & Array {#} b, [u <= v]

works. In general I'd copy paste types from the types window rather 
than an
error message.

> The same problem I have encountered when trying to specify class 
> instances
> on deeply unboxed arrays of depth bigger than one.
>
> Am I missing something, or is this a bug?

You could claim it should be a warning rather than an error but I can't 
tell
you what the clean team would say :-)

Regards,

Diederik van Arkel



More information about the clean-list mailing list