Skip to content

Commit 58af279

Browse files
committed
[#336] [stbx-protocol, studio-common] add necessary Eq and Show instances
1 parent 49ab157 commit 58af279

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

stbx-protocol/src/Statebox/Protocol/Fire.purs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import Prelude
44
import Data.Array (index)
55
import Data.Either (Either(..), either)
66
import Data.Either.Nested (type (\/))
7+
import Data.Generic.Rep (class Generic)
8+
import Data.Generic.Rep.Eq (genericEq)
9+
import Data.Generic.Rep.Show (genericShow)
710
import Data.Maybe (maybe)
811
import Data.NonEmpty (head)
912

@@ -27,6 +30,14 @@ data FiringError
2730
-- | The selected transition is not enabled
2831
| FireTransitionNotEnabled
2932

33+
derive instance genericFiringError :: Generic FiringError _
34+
35+
instance eqFiringError :: Eq FiringError where
36+
eq = genericEq
37+
38+
instance showFiringError :: Show FiringError where
39+
show = genericShow
40+
3041
fire :: Wiring -> Firing -> Marking -> FiringError \/ Marking
3142
fire wiring firing marking = maybe
3243
(Left FireInvalidWiringTree)

studio-common/src/Data/Bag.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ instance groupBagF :: (Monoid (BagF a n), Group (Additive n)) => Group (BagF a n
3232
instance showBagF :: (Show a, Show n) => Show (BagF a n) where
3333
show (BagF x) = "(BagF " <> show x <> ")"
3434

35+
instance eqBagF :: (Eq a, Eq n) => Eq (BagF a n) where
36+
eq (BagF x) (BagF y) = eq x y
37+
3538
--------------------------------------------------------------------------------
3639

3740
fromMap :: a n. Map a n -> BagF a n

0 commit comments

Comments
 (0)