--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Thu Jul 15 00:54:29 1993
--* Received: from yktvmv2.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA15116; Thu, 15 Jul 1993 00:54:29 -0400
--* X-External-Networks: yes
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 9355; Thu, 15 Jul 93 00:55:30 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.EDWARDS.NOTE.YKTVMV.6919.Jul.15.00:55:29.-0400>
--*           for asbugs@watson; Thu, 15 Jul 93 00:55:30 -0400
--* Received: from ibm4.scri.fsu.edu by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Thu, 15 Jul 93 00:55:28 EDT
--* Received: by ibm4.scri.fsu.edu id AA11172
--*   (5.65c/IDA-1.4.4 for asbugs@watson.ibm.com); Thu, 15 Jul 1993 00:55:27 -0400
--* Date: Thu, 15 Jul 1993 00:55:27 -0400
--* From: Robert Edwards <edwards@ibm4.scri.fsu.edu>
--* Message-Id: <199307150455.AA11172@ibm4.scri.fsu.edu>
--* To: asbugs@watson.ibm.com
--* Subject: Compiler bug (substitution) in samples/catdef0.as [/ds13/m/users/edwards/applications/asharp/base/rs3.2/samples/catdef0.as][A# version 29.2 for AIX RS/6000]

--@ Fixed  by: SSD Fri Jul 16 17:36:20 1993
--@ Tested by: none
--@ Summary:   Temporary problem with type inference of category maps.

--+ % asharp -rv $ASHARPROOT/samples/catdef0.as
--+ A# version 29.2 for AIX RS/6000
--+ "/ds13/m/users/edwards/applications/asharp/base/rs3.2/samples/catdef0.as", line 23:
--+ Algebra(R: Rng): Category == Join(Rng, Operator R)
--+ ................................................^
--+ [L23 C49] (Error) 0 meanings for `R' in this context.
--+
--+               ld in sc sy li pa ma ab ck sb ti gf of pb pl pc po mi
--+  Time   0.9s   0  4  1  2  1  5  1  0  0  2 83  0  0  0  0  0  0  0 %
--+  Source 159L : 9835 lines per minute
--> testcomp

#include "aslib"

-- This tests a category declaration without a definition.
export C0: Category

-- This tests an empty category definition.
C1: Category == with

Set: Category == with
	=: (%, %) -> Bit

Mon: Category == with
	1: %
	*: (%,%) -> %

Rng: Category == Join(Set, Mon)

Operator(T: Type): Category == with
	*: (T, %) -> %

Algebra(R: Rng): Category == Join(Rng, Operator R)

A(R: Rng): Algebra R == add
	import R
        (x: % = y: %): Bit == true
	r(x: %): R == x pretend R
	a(x: R): % == x pretend %
        1: %       == a 1
	(x: % * y: %): % == a(r x * r y)
	(x: R * y: %): % == a(x   * r y)

B(R: Rng): Algebra R == A R

Left: Mon == add
	Rep ==> Integer
	import Rep
        1: % == per 1
	(a: % * b: %): % == a

Right: Mon == add
	Rep ==> Integer
	import Rep
        1: % == per 1
	(a: % * b: %): % == b

#if TestErrorsToo
--!! None of these examples completely satisfy the category exports.
f(): None ==
	lt: List Type         == [Integer, Category, Rng]
	lc: List Category     == [Set, Mon, Rng, Join(Set, Mon)]
	lm: List Mon          == [Left, Right, A Left, A Right]
	ll: List Algebra Left == [A Left, B Left]
#endif
 
