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

Reorganized SetAlgebra by breaking it into 4 modules. #2564

Merged
merged 2 commits into from
Nov 29, 2021

Conversation

TimSheard
Copy link
Contributor

@TimSheard TimSheard commented Nov 25, 2021

As we introduce new datatypes that are more compact, we will need new SetAlgebra Instances. This ha become problematic since SetAgebra is a huge file, and the pieces of code pertinent to one type are spread all over.

So we reorganize by breaking it into four modules. The new ones are Control.Iterate.BaseTypes, Control.Iterate.Exp, and Control.Iterate.BiMap

To add a new type XXX, add Control.Iterate.XXX where the new type is defined.
Then add instances in Control.Iterate.BaseTypes.
The other modules Control.Iterate.SetAlgebra and Control.Iterate.Exp are independent from what the Base types are.

@nc6
Copy link
Contributor

nc6 commented Nov 29, 2021

Can you talk a little bit about the general structure? E.g. what's the difference between Control.Iterate.SetAlgebra and Control.SetAlgebra? At the moment I still don't have a general conception of how things break down here.

@TimSheard
Copy link
Contributor Author

Over view of system structure.

Normal users, who just want to use Set algebra expressions should use:
import Control.SetAlgebra(eval, setSingleton, (∩), (⊆), (▷) )

The modules
import Control.Iterate.SetAlgebra
import Control.Iterate.BaseTypes
import Control.Iterate.Exp
import Control.Iterate.BiMap

divide the system into components. imports of these modules should be limited to the SetAlgebra systems, and tests and benchmarks of the system that need lower level operations. The organization of these modules is this.

Control.Iterate.BaseTypes defines the classes that types that use the SetAlgebra system must defined instances. The file also contains instances for things like lists, sets, Data.Map etc.

Control.Iterate.BiMap defines a new type that we use in the system. Instances for this type are included in Control.Iterate.BaseTypes.

import Control.Iterate.Exp defines the internal intermediate data structures that the system uses to perform runtime pattern matching. Users do not need to understand these types.

Control.Iterate.SetAlgebra contains the evaluation strategies, eval, compute, compile etc.

…ntrol.Iterate.BaseTypes, Control.Iterate.Exp, and Control.Iterate.BiMap
@TimSheard TimSheard requested a review from nc6 November 29, 2021 16:06
Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for splitting this up @TimSheard !

@lehins lehins self-requested a review November 29, 2021 16:37
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great overall, however it seems that you reverted one of the resent PRs: #2563

libs/small-steps/src/Control/Iterate/BiMap.hs Outdated Show resolved Hide resolved
@TimSheard TimSheard merged commit ccaecc8 into master Nov 29, 2021
@iohk-bors iohk-bors bot deleted the ts-reorg-setalgebra branch November 29, 2021 21:32
@lehins lehins mentioned this pull request Jul 5, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants