Skip to content

Commit 17fcbb1

Browse files
committed
Add roles declarations to forbid unsafe coercions
1 parent 851327d commit 17fcbb1

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
@@ -39,6 +39,8 @@ quote s = "\"" <> s <> "\""
3939

4040
newtype Key a = Key Prefixed
4141

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

src/CSS/Size.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import CSS.String (class IsString, fromString)
88

99
newtype Size a = Size Value
1010

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

@@ -79,6 +81,8 @@ data Rad
7981

8082
newtype Angle a = Angle Value
8183

84+
type role Angle nominal
85+
8286
derive instance eqAngle :: Eq a => Eq (Angle a)
8387
derive instance ordAngle :: Ord a => Ord (Angle a)
8488

0 commit comments

Comments
 (0)