From 757605e569d4eee64b51c357ed513fa080a0af6e Mon Sep 17 00:00:00 2001 From: Koz Ross Date: Tue, 24 Sep 2024 09:45:50 +1200 Subject: [PATCH] Fix roles for Vector and MVector size parameters --- changelog.md | 3 +++ src/Data/Vector/Generic/Mutable/Sized/Internal.hs | 3 +++ src/Data/Vector/Generic/Sized/Internal.hs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/changelog.md b/changelog.md index 6befbc2..5582543 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,9 @@ ## WIP +- Fix roles for `MVector` and `Vector` to no longer declare their sizes as + phantom + ## [1.6.1] - Fix build against Stackage nightly for GHC 9.4.5 diff --git a/src/Data/Vector/Generic/Mutable/Sized/Internal.hs b/src/Data/Vector/Generic/Mutable/Sized/Internal.hs index 70a77b7..c3d7976 100644 --- a/src/Data/Vector/Generic/Mutable/Sized/Internal.hs +++ b/src/Data/Vector/Generic/Mutable/Sized/Internal.hs @@ -2,6 +2,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RoleAnnotations #-} {-# OPTIONS_HADDOCK not-home #-} module Data.Vector.Generic.Mutable.Sized.Internal @@ -20,3 +21,5 @@ import Foreign.Storable -- which have a different length than that specified in the type parameter! newtype MVector v (n :: Nat) s a = MVector (v s a) deriving ( Typeable, Data, Storable, NFData ) + +type role MVector representational nominal nominal nominal diff --git a/src/Data/Vector/Generic/Sized/Internal.hs b/src/Data/Vector/Generic/Sized/Internal.hs index 742ea52..5f2114d 100644 --- a/src/Data/Vector/Generic/Sized/Internal.hs +++ b/src/Data/Vector/Generic/Sized/Internal.hs @@ -4,6 +4,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RoleAnnotations #-} {-# OPTIONS_HADDOCK not-home #-} module Data.Vector.Generic.Sized.Internal @@ -52,6 +53,8 @@ newtype Vector v (n :: Nat) a = Vector (v a) , Data, Typeable ) +type role Vector representational nominal nominal + instance (Ix a, Ord (v a), VG.Vector v a) => Ix (Vector v n a) where -- range is consistent with range :: ((a,..,a), (a,..,a)) -> [(a,..,a)]