Refactor common accessor functions of internal and remote NodeState to a type class with 2 types #20

Closed
opened 2020-05-20 14:30:51 +02:00 by schmittlauch · 0 comments
Owner

Currently, NodeState is used for representing both the internal local nodes. As the local nodes contain local configuration parameters not present in the representation of remote nodes, this InternalNodeState is wrapped into a Maybe.

But these parameteres are mostly accessed in functions that deal with local nodes only anyways. That renders the case disticntion between Just and Nothing to be unnecessary boilerplate.

Proposal:
Create a new type class that contains the accessor functions for values present in both NodeState types. Rename the the current NodeState without internals to RemoteNodeState. The LocalNodeState is a composite type that holds a RemoteNodeState and the internal values, with accessor functions designed to remove that composition indirection.

Currently, `NodeState` is used for representing both the internal local nodes. As the local nodes contain local configuration parameters not present in the representation of remote nodes, this `InternalNodeState` is wrapped into a Maybe. But these parameteres are mostly accessed in functions that deal with local nodes only anyways. That renders the case disticntion between Just and Nothing to be unnecessary boilerplate. **Proposal**: Create a new type class that contains the accessor functions for values present in both NodeState types. Rename the the current `NodeState` without internals to `RemoteNodeState`. The `LocalNodeState` is a composite type that holds a `RemoteNodeState` and the internal values, with accessor functions designed to remove that composition indirection.
schmittlauch self-assigned this 2020-05-20 14:30:52 +02:00
schmittlauch added the
refactoring
label 2020-05-20 14:32:24 +02:00
schmittlauch started working 2020-05-22 23:38:43 +02:00
schmittlauch stopped working 2020-05-22 23:38:52 +02:00
8s
schmittlauch added spent time 2020-05-22 23:39:06 +02:00
4h 50min
schmittlauch started working 2020-06-09 14:03:01 +02:00
schmittlauch canceled time tracking 2020-06-09 14:03:11 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 4 hours 50 minutes
schmittlauch
4 hours 50 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: schmittlauch/Hash2Pub#20
No description provided.