Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DefinesQuantity for InstanceModel and DataDefinition #3627

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/drasil-theory/lib/Theory/Drasil/DataDefinition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ instance HasUID DataDefinition where uid = ddQD uid uid
instance NamedIdea DataDefinition where term = ddQD term term
-- | Finds the idea contained in the 'QDefinition' used to make the 'DataDefinition where'.
instance Idea DataDefinition where getA = either getA getA . qdFromDD
-- | Finds the 'Quantity' defined by the 'DataDefinition'
instance DefinesQuantity DataDefinition where
defLhs = ddQDGetter defLhs defLhs
samm82 marked this conversation as resolved.
Show resolved Hide resolved
-- | Finds the output variable of the 'DataDefinition'
instance HasOutput DataDefinition where
output = ddQDGetter defLhs defLhs
Expand Down
3 changes: 3 additions & 0 deletions code/drasil-theory/lib/Theory/Drasil/InstanceModel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ instance CommonIdea InstanceModel where abrv _ = abrv inModel
instance Referable InstanceModel where
refAdd = ra
renderRef l = RP (prepend $ abrv l) (refAdd l)
-- | Finds the 'Quantity' of an 'InstanceModel'
instance DefinesQuantity InstanceModel where
defLhs = imOutput . _1
-- | Finds the inputs of an 'InstanceModel'.
instance HasInputs InstanceModel where
inputs = imInputs
Expand Down