-
Notifications
You must be signed in to change notification settings - Fork 2
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
🧑💻 Use opaque type for models #259
Conversation
WalkthroughThese changes involve a systematic refactoring across several Elm modules. The primary focus is on renaming the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant View
participant Update
participant Model
User->>+View: Interact
View->>+Model: Access ModelRecord
Model->>-View: Wrapped Model
View->>+Update: Send Msg
Update->>+Model: Update ModelRecord
Model->>-Update: Updated ModelRecord
Update->>-View: Updated Model
View->>+User: Rendered View
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- src/Page/About.elm (2 hunks)
- src/Page/Asteroids.elm (6 hunks)
- src/Page/Calc.elm (15 hunks)
- src/Page/DigitalClock.elm (7 hunks)
- src/Page/Lissajous.elm (7 hunks)
- src/Page/Maze.elm (6 hunks)
- src/Page/Physics.elm (11 hunks)
- src/Page/Term.elm (4 hunks)
Additional comments not posted (47)
src/Page/Term.elm (5)
32-32
: LGTM! ModelRecord type alias introduced.The
ModelRecord
type alias encapsulates theterm
field.
37-39
: LGTM! Model type introduced.The
Model
type encapsulatesModelRecord
.
40-52
: LGTM! init function updated.The
init
function initializes theModel
withModelRecord
and aCmd
batch.
71-82
: LGTM! update function updated.The
update
function updates theModel
using pattern matching andTuple.mapFirst
.
115-115
: LGTM! view function updated.The
view
function renders theModel
using theTerm.render
function.src/Page/About.elm (4)
31-31
: LGTM! ModelRecord type alias introduced.The
ModelRecord
type alias encapsulates thebasePath
field.
36-38
: LGTM! Model type introduced.The
Model
type encapsulatesModelRecord
.
39-44
: LGTM! init function updated.The
init
function initializes theModel
withModelRecord
andCmd.none
.
76-76
: LGTM! view function updated.The
view
function renders theModel
using thebasePath
field.src/Page/DigitalClock.elm (7)
45-45
: LGTM! ModelRecord type alias introduced.The
ModelRecord
type alias encapsulates multiple fields.
57-59
: LGTM! Model type introduced.The
Model
type encapsulatesModelRecord
.
60-63
: LGTM! init function updated.The
init
function initializes theModel
withModelRecord
andinitialCmd
.
98-147
: LGTM! update function updated.The
update
function updates theModel
using pattern matching andTuple.mapFirst
.
155-155
: LGTM! subscriptions function updated.The
subscriptions
function sets up subscriptions using theModelRecord
.
167-167
: LGTM! view function updated.The
view
function renders theModel
using various HTML elements.
502-502
: LGTM! digitalClock function updated.The
digitalClock
function renders the digital clock using SVG elements.src/Page/Calc.elm (9)
44-44
: LGTM! ModelRecord type alias introduced.The
ModelRecord
type alias encapsulates multiple fields.
53-55
: LGTM! Model type introduced.The
Model
type encapsulatesModelRecord
.
56-65
: LGTM! init function updated.The
init
function initializes theModel
withModelRecord
andCmd.none
.
102-169
: LGTM! update function updated.The
update
function updates theModel
using pattern matching andTuple.mapFirst
.
174-174
: LGTM! apply function updated.The
apply
function applies a token to theModelRecord
and returns a newModelRecord
.
314-314
: LGTM! doAccumulate function updated.The
doAccumulate
function accumulates digits in theModelRecord
.
334-334
: LGTM! doOperator function updated.The
doOperator
function performs operations on theModelRecord
.
391-397
: LGTM! doClear function updated.The
doClear
function clears theModelRecord
.
472-472
: LGTM! view function updated.The
view
function renders theModel
using various HTML elements.src/Page/Lissajous.elm (6)
52-52
: RenamedModel
toModelRecord
.The
Model
type alias has been renamed toModelRecord
to improve clarity and encapsulation.
94-95
: Introduced newModel
type.A new
Model
type has been introduced to encapsulateModelRecord
, enhancing type safety and abstraction.
113-127
: Updatedinit
function to use newModel
type.The
init
function now initializes aModel
with aModelRecord
, consistent with the new type definitions.
154-294
: Updatedupdate
function to use newModel
type.The
update
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.
302-302
: Updatedsubscriptions
function to use newModel
type.The
subscriptions
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.
332-332
: Updatedview
function to use newModel
type.The
view
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.src/Page/Maze.elm (6)
94-94
: RenamedModel
toModelRecord
.The
Model
type alias has been renamed toModelRecord
to improve clarity and encapsulation.
101-102
: Introduced newModel
type.A new
Model
type has been introduced to encapsulateModelRecord
, enhancing type safety and abstraction.
107-107
: Updatedinit
function to use newModel
type.The
init
function now initializes aModel
with aModelRecord
, consistent with the new type definitions.
331-331
: Updatedupdate
function to use newModel
type.The
update
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.
410-411
: Updatedsubscriptions
function to use newModel
type.The
subscriptions
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.
423-423
: Updatedview
function to use newModel
type.The
view
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.src/Page/Physics.elm (6)
868-868
: RenamedModel
toModelRecord
.The
Model
type alias has been renamed toModelRecord
to improve clarity and encapsulation.
895-896
: Introduced newModel
type.A new
Model
type has been introduced to encapsulateModelRecord
, enhancing type safety and abstraction.
901-910
: Updatedinit
function to use newModel
type.The
init
function now initializes aModel
with aModelRecord
, consistent with the new type definitions.
934-991
: Updatedupdate
function to use newModel
type.The
update
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.
999-1000
: Updatedsubscriptions
function to use newModel
type.The
subscriptions
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.
1012-1012
: Updatedview
function to use newModel
type.The
view
function now uses pattern matching to extract theModelRecord
from theModel
, consistent with the new type definitions.src/Page/Asteroids.elm (4)
Line range hint
751-755
:
LGTM! TheModelRecord
type alias is well-defined.The encapsulation of
world
,keys
, andframes
properties is correctly typed and initialized.
760-762
: LGTM! TheModel
type encapsulation is correct.The encapsulation of
ModelRecord
withinModel
is correctly implemented.
1200-1231
: LGTM! Theupdate
function handles the newModel
type correctly.The pattern matching and updates to the
Model
properties are correctly implemented.
Line range hint
1256-1279
:
LGTM! Theview
function correctly renders the newModel
type.The pattern matching and rendering logic are correctly implemented.
Self explanatory.