Skip to content

Add roles declarations to forbid unsafe coercions #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CSS/Property.purs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ quote s = "\"" <> s <> "\""
newtype Key :: Type -> Type
newtype Key a = Key Prefixed

type role Key representational

derive instance eqKey :: (Eq a) => Eq (Key a)
derive instance ordKey :: (Ord a) => Ord (Key a)

Expand Down
4 changes: 4 additions & 0 deletions src/CSS/Size.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import CSS.String (class IsString, fromString)
newtype Size :: Type -> Type
newtype Size a = Size Value

type role Size nominal

derive instance eqSize :: Eq a => Eq (Size a)
derive instance ordSize :: Ord a => Ord (Size a)

Expand Down Expand Up @@ -81,6 +83,8 @@ data Rad
newtype Angle :: Type -> Type
newtype Angle a = Angle Value

type role Angle nominal

derive instance eqAngle :: Eq a => Eq (Angle a)
derive instance ordAngle :: Ord a => Ord (Angle a)

Expand Down