From 6b3ae55e60ddd96a463de0ef4ddb71af12ca8794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Akg=C3=BCn?= Date: Sun, 16 Feb 2025 10:16:43 +0000 Subject: [PATCH] matrices can be indexed by other matrices --- src/Conjure/Language/Domain.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Conjure/Language/Domain.hs b/src/Conjure/Language/Domain.hs index 856a2f014..359798990 100644 --- a/src/Conjure/Language/Domain.hs +++ b/src/Conjure/Language/Domain.hs @@ -285,7 +285,7 @@ isPrimitiveDomain :: Domain r x -> Bool isPrimitiveDomain DomainBool{} = True isPrimitiveDomain DomainIntE{} = True isPrimitiveDomain DomainInt{} = True -isPrimitiveDomain (DomainMatrix index inner) = and [isPrimitiveDomain index, isPrimitiveDomain inner] +isPrimitiveDomain (DomainMatrix index inner) = isPrimitiveDomain index && isPrimitiveDomain inner isPrimitiveDomain _ = False getIndices :: Domain r x -> ([Domain () x], Domain r x) @@ -298,6 +298,7 @@ domainCanIndexMatrix DomainBool{} = True domainCanIndexMatrix DomainInt {} = True domainCanIndexMatrix DomainIntE{} = True domainCanIndexMatrix DomainEnum{} = True +domainCanIndexMatrix (DomainMatrix index inner) = domainCanIndexMatrix index && domainCanIndexMatrix inner domainCanIndexMatrix _ = False expandDomainReference :: Data r => Data x => Domain r x -> Domain r x @@ -613,7 +614,7 @@ instance Semigroup BinaryRelationAttrs where (<>) (BinaryRelationAttrs a) (BinaryRelationAttrs b) = BinaryRelationAttrs (S.union a b) instance Monoid BinaryRelationAttrs where mempty = BinaryRelationAttrs def - + data BinaryRelationAttr