Skip to content

Commit 9950957

Browse files
strakecartazio
authored andcommitted
make Data.Vector.Generic.Base.Mutable injective (#160)
* make Data.Vector.Generic.Base.Mutable injective * Add test, use __GLASGOW_HASKELL_
1 parent 3432862 commit 9950957

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Data/Vector/Generic/Base.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{-# LANGUAGE Rank2Types, MultiParamTypeClasses, FlexibleContexts,
22
TypeFamilies, ScopedTypeVariables, BangPatterns #-}
3+
{-# LANGUAGE CPP #-}
4+
#if __GLASGOW_HASKELL__ >= 800
5+
{-# LANGUAGE TypeFamilyDependencies #-}
6+
#endif
37
{-# OPTIONS_HADDOCK hide #-}
48

59
-- |
@@ -24,9 +28,13 @@ import qualified Data.Vector.Generic.Mutable.Base as M
2428
import Control.Monad.Primitive
2529

2630
-- | @Mutable v s a@ is the mutable version of the pure vector type @v a@ with
27-
-- the state token @s@
31+
-- the state token @s@. It is injective on GHC 8 and newer.
2832
--
33+
#if MIN_VERSION_base(4,9,0)
34+
type family Mutable (v :: * -> *) = (mv :: * -> * -> *) | mv -> v
35+
#else
2936
type family Mutable (v :: * -> *) :: * -> * -> *
37+
#endif
3038

3139
-- | Class of immutable vectors. Every immutable vector is associated with its
3240
-- mutable version through the 'Mutable' type family. Methods of this class

0 commit comments

Comments
 (0)