Skip to content

Commit

Permalink
Make BLS Point nominal to avoid incorrect Coercible instances
Browse files Browse the repository at this point in the history
  • Loading branch information
tdammers authored and iquerejeta committed Mar 23, 2023
1 parent 18a0d00 commit c41c920
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RoleAnnotations #-}

module Cardano.Crypto.EllipticCurve.BLS12_381.Internal
(
Expand Down Expand Up @@ -221,6 +222,10 @@ instance BLS curve => Eq (AffinePtr curve) where
-- | prime order subgroup.
newtype Point curve = Point (ForeignPtr Void)

-- Making sure different 'Point's are not 'Coercible', which would ruin the
-- intended type safety:
type role Point nominal

type Point1 = Point Curve1
type Point2 = Point Curve2

Expand Down

0 comments on commit c41c920

Please sign in to comment.