Skip to content

Commit c9592dc

Browse files
authored
Add roles declarations to forbid unsafe coercions (#120)
1 parent 9573028 commit c9592dc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/CSS/Property.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ quote s = "\"" <> s <> "\""
4040
newtype Key :: Type -> Type
4141
newtype Key a = Key Prefixed
4242

43+
type role Key representational
44+
4345
derive instance eqKey :: (Eq a) => Eq (Key a)
4446
derive instance ordKey :: (Ord a) => Ord (Key a)
4547

src/CSS/Size.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import CSS.String (class IsString, fromString)
99
newtype Size :: Type -> Type
1010
newtype Size a = Size Value
1111

12+
type role Size nominal
13+
1214
derive instance eqSize :: Eq a => Eq (Size a)
1315
derive instance ordSize :: Ord a => Ord (Size a)
1416

@@ -81,6 +83,8 @@ data Rad
8183
newtype Angle :: Type -> Type
8284
newtype Angle a = Angle Value
8385

86+
type role Angle nominal
87+
8488
derive instance eqAngle :: Eq a => Eq (Angle a)
8589
derive instance ordAngle :: Ord a => Ord (Angle a)
8690

0 commit comments

Comments
 (0)