Skip to content

Commit f034c92

Browse files
authored
Refactor wirings, paths, routes, etc. #331 (WIP) (#356)
* stbx-core: Split Wiring, Net, Diagram into their own modules and introduce wiring label newtype. #331 - [x] Newtype the `labels` in `Wiring`; is now `Array Int`, should be `Array <some newtype>` - [x] Split off module `Statebox.Core.Net` from `Statebox.Core.Types` - [x] Split off module `Statebox.Core.Diagram` from `Statebox.Core.Types` - [x] Split off module `Statebox.Core.Wiring` from `Statebox.Core.Types` - [x] Introduce the `labels` newtype mentioned in parent task. - [x] Fix transaction codec breakage. * stbx-core: Move Firing, Initial, Common submodules out of Statebox.Core.Types. #331 * stbx-core: Define GluedTransitionId(Raw) alongside Wiring and use it in Execution. #331 * stbx-core: Move Path, PathElem into Statebox.Core.Wiring.Tree. #331 * stbx-core: Remove redirects to Path, PathElem from Statebox.Core.Execution. #331 * stbx-core: Alias Transaction.TxId to Core.Types.TxId. #331
1 parent 669dd9a commit f034c92

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

Diff for: stbx-core/src/Statebox/Core/Execution.purs

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Data.Newtype (unwrap)
88
import Unsafe.Coerce (unsafeCoerce)
99

1010
import Statebox.Core.Types (PID, TID, Wiring, GluedTransitionIdRaw, GluedTransitionId(..))
11+
import Statebox.Core.Wiring.Tree (Path, PathElem)
1112

1213

1314
-- | ReasonML-encoded representation of a marked net.
@@ -81,11 +82,6 @@ pretty = case _ of
8182
Glued -> "glued"
8283
Final -> "final"
8384

84-
type PathElem = Int
85-
86-
-- | A path to a leaf (i.e. a net) in the diagram tree.
87-
type Path = Array PathElem
88-
8985
-- TODO Since we already have Path as an isolated type, this PathIndexed may not add much value
9086
type PathIndexed r = (path :: Path | r)
9187

Diff for: stbx-core/src/Statebox/Core/Transaction.purs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ module Statebox.Core.Transaction where
33
import Prelude
44
import Data.Maybe (Maybe(..), isNothing)
55
import Statebox.Core.Types (Initial, Firing, Wiring, HexStr)
6+
import Statebox.Core.Types (TxId) as Core
67

78
type HashStr = HexStr
89

9-
type TxId = HexStr
10+
-- | TODO We'll probably want to remove this redirect. #331
11+
type TxId = Core.TxId
1012

1113
type StatusStr = String
1214

Diff for: stbx-core/src/Statebox/Core/Types.purs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Statebox.Core.Types
22
( module Statebox.Core.Net
33
, module Statebox.Core.Diagram
44
, module Statebox.Core.Wiring
5+
, module Statebox.Core.Wiring.Tree
56
, module Statebox.Core.Firing
67
, module Statebox.Core.Initial
78
, module Statebox.Core.Common
@@ -10,6 +11,7 @@ module Statebox.Core.Types
1011
import Statebox.Core.Net
1112
import Statebox.Core.Diagram
1213
import Statebox.Core.Wiring
14+
import Statebox.Core.Wiring.Tree
1315
import Statebox.Core.Firing
1416
import Statebox.Core.Initial
1517
import Statebox.Core.Common

Diff for: stbx-core/src/Statebox/Core/Wiring/Tree/Path.purs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Statebox.Core.Wiring.Tree where
2+
3+
-- | A path to a leaf (i.e. a net) in the diagram tree.
4+
type Path = Array PathElem
5+
6+
type PathElem = Int

Diff for: studio/src/View/Studio/Model.purs

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import Data.Diagram.FromNLL (ErrDiagramEncoding)
2020
import Data.Petrinet.Representation.NLL as Net
2121
import Data.Petrinet.Representation.PNPRO as PNPRO
2222
import Data.Petrinet.Representation.PNPROtoDict as PNPRO
23-
import Statebox.Core.Execution (PathElem)
24-
import Statebox.Core.Types (Diagram)
23+
import Statebox.Core.Types (Diagram, PathElem)
2524
import Statebox.Core.Transaction (HashStr, TxSum, FiringTx, WiringTx)
2625
import Statebox.Core.Lenses (_wiringTx, _firingTx)
2726
import View.Diagram.Model (DiagramInfo)

Diff for: studio/src/View/Studio/Model/Route.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Data.Either.Nested (type (\/))
66
import Data.Maybe (Maybe)
77
import Data.Tuple.Nested (type (/\))
88
import View.Model (ProjectName)
9-
import Statebox.Core.Execution (PathElem)
9+
import Statebox.Core.Types (PathElem)
1010
import Statebox.Core.Transaction (HashStr, Tx, TxSum(..), WiringTx, FiringTx, evalTxSum)
1111

1212
type Route = RouteF ProjectName DiagramName NetName

0 commit comments

Comments
 (0)