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

Chunks in drasil-lang that use Maybe instead of Lenses #2677

Open
10 tasks
Ant13731 opened this issue Jul 12, 2021 · 5 comments
Open
10 tasks

Chunks in drasil-lang that use Maybe instead of Lenses #2677

Ant13731 opened this issue Jul 12, 2021 · 5 comments
Assignees
Labels
needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities.

Comments

@Ant13731
Copy link
Collaborator

Ant13731 commented Jul 12, 2021

Here is a list of types that use Maybe (referring to the Rationalizing data structures project). Each one is formatted so that the list above encases the type, the list below contains the dependencies of the type, and the type itself is marked as a task.

Chunk types

  • UncertainChunk
    • ConstrainedChunk
      • Maybe Expr, QuantityDict, [ConstraintE]
  • UncertQ
    • ConstrConcept
      • Maybe Expr, DefinedQuantityDict, [ConstraintE]
  • UnitalChunk, ConstrConcept
    • DefinedQuantityDict
      • Maybe UnitDefn, ConceptChunk, Stage -> Symbol, Space
  • ConceptChunk, QuantityDict
    • IdeaDict
      • Maybe String, NamedChunk
  • ConstrainedChunk, QDefinition, NamedArgument, UnitaryChunk
    • QuantityDict
      • Maybe UnitDefn, IdeaDict, Space, Stage -> Symbol
  • UncertainChunk, UncertQ
    • Uncertainty
      • Maybe Double, Maybe Int

Classes

  • --
    • MayHaveUnit
      • Maybe UnitDefn
  • --
    • HasDerivation
      • lens to Maybe Derivation
  • --
    • HasReasVal
      • lens to Maybe Expr

Other

  • --
    • ListType, ListTuple, RawContent
      • not a chunk, but still uses Maybe String or Maybe Int

Edit: Related to #1808 and #2614

@balacij
Copy link
Collaborator

balacij commented Jul 12, 2021

I believe that @Awurama-N has started work on the first 2 components (UncertainChunk + UncertQ). I'm not quite sure where the ticket went however.

@JacquesCarette
Copy link
Owner

Yes, @Awurama-N was working on that. I see that maybe there is an easier set of things to change -- the Maybe UnitDefn in DefinedQuantityDict should simply be deleted. Of course, it's not that easy! The proper process will involve seeing what the actual calls to the various dqd constructors are. But this should be doable.

So @Awurama-N can you open a new issue, where the first part will be to see all calls to dqd, dqdNoUnit, dqd', dqdWr and dqdQd in all of Drasil (not just the examples). We'll see what should be done from there. This is definitely a really awful wart that can be fixed.

@balacij
Copy link
Collaborator

balacij commented Apr 27, 2023

So, I believe this ticket was about analyzing which Maybe and trying to get rid of Maybe usage. However, I'm not sure I fully understand why we're trying to get rid of Maybe.

@samm82
Copy link
Collaborator

samm82 commented Apr 27, 2023

I think we may have backtracked on trying to do this and will continue to use Maybe. However, the specifics of when this happens throughout the Drasil process is yet to be determined and requires more thought

@JacquesCarette
Copy link
Owner

Right, I think I may have changed my mind on Maybe. We can and should use it for truly optional information.

We should never use it if we always expect to get a Just and getting a Nothing is an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities.
Projects
None yet
Development

No branches or pull requests

5 participants