Ampersand
Ampersand copied to clipboard
Changes to FormalAmpersand
This issue is under construction...
Problem
When you change code in the FormalAmpersand codebase, the Haskell compiler will most certainly produce errors. That is because the meatgrinder code needs to remain in sync with the FormalAmpersand code. This issue investigates which Haskell code you must change to keep things working.
Describe the solution you'd like We want to make clear to the users what to do when a change to FormalAmpersand is made. Steps to do:
- change a relation in FormalAmpersand
- change the transformer in
src>Ampersand>FSpec>Transformers.hs
- Test it on a
.adl
-file of your linking with--build-recipe Grind
, so you can see the result (for example in JSON format), by using the command:
ampersand population testing/Travis/testcases/prototype/shouldSucceed/InterfaceTest1.adl --build-recipe Grind --verbose --output-format JSON
Example
Let's do this with an example. The problem is that FormalAmpersand does not contain ConceptDef
s yet. So let us introduce a relation that links Concept
to ConceptDef
in FormalAmpersand. In Haskell, this is a function acdcpt :: Concept->ConceptDef
, so let's call this relation acdcpt
to match the names in FormalAmpersand and Haskell.
REPRESENT ConceptDef TYPE BIGALPHANUMERIC
RELATION acdcpt[Concept*ConceptDef] [UNI]
RULE delUnusedConceptDef : I[ConceptDef] |- acdcpt~;acdcpt
MEANING "A ConceptDef without Concept will be removed."
ROLE User MAINTAINS delUnusedConceptDef
Obviously, a ConceptDef
without a Concept
makes no sense, so the user gets to resolve that.
So much for the FormalAmpersand part. Now we must match the relation acdcpt[Concept*ConceptDef]
by a relation in the meatgrinder and tell the compiler how to populate metamodels with this information.
( "acdcpt",
"Concept",
"ConceptDef",
Set.fromList [Uni],
[ (dirtyId cpt, (PopAlphaNumeric . acdcpt) cpt)
| cpt :: AConceptDef <- instanceList fSpec,
(not . T.null . acdcpt) cpt
]
),