basement 0.0.11 → 0.0.12
raw patch · 7 files changed
+23/−12 lines, 7 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Basement.Block: instance (Basement.Monad.PrimMonad prim, st Data.Type.Equality.~ Basement.Monad.PrimState prim, Basement.PrimType.PrimType ty) => Basement.Alg.Class.RandomAccess (Basement.Block.Base.MutableBlock ty st) prim ty
- Basement.BoxedArray: instance (Basement.Monad.PrimMonad prim, st Data.Type.Equality.~ Basement.Monad.PrimState prim) => Basement.Alg.Class.RandomAccess (Basement.BoxedArray.MArray ty st) prim ty
- Basement.Compat.Base: fail :: Monad m => String -> m a
- Basement.From: instance (Basement.PrimType.PrimType a, Basement.PrimType.PrimType b, GHC.TypeNats.KnownNat n, GHC.TypeNats.KnownNat m, (Basement.PrimType.PrimSize b GHC.TypeNats.* m) Data.Type.Equality.~ (Basement.PrimType.PrimSize a GHC.TypeNats.* n)) => Basement.From.From (Basement.Sized.Block.BlockN n a) (Basement.Sized.Block.BlockN m b)
- Basement.Imports: fail :: Monad m => String -> m a
+ Basement.Block: instance (Basement.Monad.PrimMonad prim, st GHC.Types.~ Basement.Monad.PrimState prim, Basement.PrimType.PrimType ty) => Basement.Alg.Class.RandomAccess (Basement.Block.Base.MutableBlock ty st) prim ty
+ Basement.BoxedArray: instance (Basement.Monad.PrimMonad prim, st GHC.Types.~ Basement.Monad.PrimState prim) => Basement.Alg.Class.RandomAccess (Basement.BoxedArray.MArray ty st) prim ty
+ Basement.Compat.Primitive: unsafeCoerce# :: forall (k0 :: RuntimeRep) (k1 :: RuntimeRep) (a :: TYPE k0) (b :: TYPE k1). a -> b
+ Basement.From: instance (Basement.PrimType.PrimType a, Basement.PrimType.PrimType b, GHC.TypeNats.KnownNat n, GHC.TypeNats.KnownNat m, (Basement.PrimType.PrimSize b GHC.TypeNats.* m) GHC.Types.~ (Basement.PrimType.PrimSize a GHC.TypeNats.* n)) => Basement.From.From (Basement.Sized.Block.BlockN n a) (Basement.Sized.Block.BlockN m b)
+ Basement.Numerical.Additive: instance Basement.Numerical.Additive.Additive GHC.Real.Rational
- Basement.Bounded: zn64Nat :: forall m n. (KnownNat m, KnownNat n, NatWithinBound Word64 m, NatWithinBound Word64 n, CmpNat m n ~ 'LT) => Proxy m -> Zn64 n
+ Basement.Bounded: zn64Nat :: forall m n. (KnownNat m, KnownNat n, NatWithinBound Word64 m, NatWithinBound Word64 n, CmpNat m n ~ 'LT) => Proxy m -> Zn64 n
- Basement.Bounded: znNat :: forall m n. (KnownNat m, KnownNat n, CmpNat m n ~ 'LT) => Proxy m -> Zn n
+ Basement.Bounded: znNat :: forall m n. (KnownNat m, KnownNat n, CmpNat m n ~ 'LT) => Proxy m -> Zn n
- Basement.Compat.Base: ($!) :: () => (a -> b) -> a -> b
+ Basement.Compat.Base: ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- Basement.Compat.Base: ($) :: () => (a -> b) -> a -> b
+ Basement.Compat.Base: ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- Basement.Compat.Base: (.) :: Category cat => cat b c -> cat a b -> cat a c
+ Basement.Compat.Base: (.) :: forall (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
- Basement.Compat.Base: const :: () => a -> b -> a
+ Basement.Compat.Base: const :: a -> b -> a
- Basement.Compat.Base: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
+ Basement.Compat.Base: either :: (a -> c) -> (b -> c) -> Either a b -> c
- Basement.Compat.Base: error :: HasCallStack => [Char] -> a
+ Basement.Compat.Base: error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
- Basement.Compat.Base: flip :: () => (a -> b -> c) -> b -> a -> c
+ Basement.Compat.Base: flip :: (a -> b -> c) -> b -> a -> c
- Basement.Compat.Base: fst :: () => (a, b) -> a
+ Basement.Compat.Base: fst :: (a, b) -> a
- Basement.Compat.Base: gmapQr :: Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
+ Basement.Compat.Base: gmapQr :: forall r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
- Basement.Compat.Base: id :: Category cat => cat a a
+ Basement.Compat.Base: id :: forall (a :: k). Category cat => cat a a
- Basement.Compat.Base: infixr 0 $!
+ Basement.Compat.Base: infixr 0 `seq`
- Basement.Compat.Base: maybe :: () => b -> (a -> b) -> Maybe a -> b
+ Basement.Compat.Base: maybe :: b -> (a -> b) -> Maybe a -> b
- Basement.Compat.Base: seq :: () => a -> b -> b
+ Basement.Compat.Base: seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- Basement.Compat.Base: snd :: () => (a, b) -> b
+ Basement.Compat.Base: snd :: (a, b) -> b
- Basement.Compat.Base: throw :: Exception e => e -> a
+ Basement.Compat.Base: throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a
- Basement.Compat.Base: type family Item l :: Type;
+ Basement.Compat.Base: type family Item l;
- Basement.Compat.Base: undefined :: HasCallStack => a
+ Basement.Compat.Base: undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
- Basement.Compat.IsList: type family Item l :: Type;
+ Basement.Compat.IsList: type family Item l;
- Basement.Imports: ($!) :: () => (a -> b) -> a -> b
+ Basement.Imports: ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- Basement.Imports: ($) :: () => (a -> b) -> a -> b
+ Basement.Imports: ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- Basement.Imports: (.) :: Category cat => cat b c -> cat a b -> cat a c
+ Basement.Imports: (.) :: forall (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
- Basement.Imports: const :: () => a -> b -> a
+ Basement.Imports: const :: a -> b -> a
- Basement.Imports: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
+ Basement.Imports: either :: (a -> c) -> (b -> c) -> Either a b -> c
- Basement.Imports: flip :: () => (a -> b -> c) -> b -> a -> c
+ Basement.Imports: flip :: (a -> b -> c) -> b -> a -> c
- Basement.Imports: fst :: () => (a, b) -> a
+ Basement.Imports: fst :: (a, b) -> a
- Basement.Imports: gmapQr :: Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
+ Basement.Imports: gmapQr :: forall r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
- Basement.Imports: id :: Category cat => cat a a
+ Basement.Imports: id :: forall (a :: k). Category cat => cat a a
- Basement.Imports: infixr 0 $!
+ Basement.Imports: infixr 0 `seq`
- Basement.Imports: maybe :: () => b -> (a -> b) -> Maybe a -> b
+ Basement.Imports: maybe :: b -> (a -> b) -> Maybe a -> b
- Basement.Imports: seq :: () => a -> b -> b
+ Basement.Imports: seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- Basement.Imports: snd :: () => (a, b) -> b
+ Basement.Imports: snd :: (a, b) -> b
- Basement.Imports: throw :: Exception e => e -> a
+ Basement.Imports: throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a
- Basement.Imports: undefined :: HasCallStack => a
+ Basement.Imports: undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
- Basement.Nat: natVal :: KnownNat n => proxy n -> Integer
+ Basement.Nat: natVal :: forall (n :: Nat) proxy. KnownNat n => proxy n -> Integer
- Basement.Nat: type (<=) (x :: Nat) (y :: Nat) = x <=? y ~ True
+ Basement.Nat: type (x :: Nat) <= (y :: Nat) = x <=? y ~ 'True
- Basement.Sized.Block: indexStatic :: forall i n ty. (KnownNat i, CmpNat i n ~ 'LT, PrimType ty, Offsetable ty i) => BlockN n ty -> ty
+ Basement.Sized.Block: indexStatic :: forall i n ty. (KnownNat i, CmpNat i n ~ 'LT, PrimType ty, Offsetable ty i) => BlockN n ty -> ty
- Basement.Sized.Block: intersperse :: (CmpNat n 1 ~ 'GT, PrimType ty) => ty -> BlockN n ty -> BlockN ((n + n) - 1) ty
+ Basement.Sized.Block: intersperse :: (CmpNat n 1 ~ 'GT, PrimType ty) => ty -> BlockN n ty -> BlockN ((n + n) - 1) ty
- Basement.Sized.Block: splitAt :: forall i n ty. (CmpNat i n ~ 'LT, PrimType ty, KnownNat i, Countable ty i) => BlockN n ty -> (BlockN i ty, BlockN (n - i) ty)
+ Basement.Sized.Block: splitAt :: forall i n ty. (CmpNat i n ~ 'LT, PrimType ty, KnownNat i, Countable ty i) => BlockN n ty -> (BlockN i ty, BlockN (n - i) ty)
- Basement.Sized.Block: sub :: forall i j n ty. ((i <=? n) ~ 'True, (j <=? n) ~ 'True, (i <=? j) ~ 'True, PrimType ty, KnownNat i, KnownNat j, Offsetable ty i, Offsetable ty j) => BlockN n ty -> BlockN (j - i) ty
+ Basement.Sized.Block: sub :: forall i j n ty. ((i <=? n) ~ 'True, (j <=? n) ~ 'True, (i <=? j) ~ 'True, PrimType ty, KnownNat i, KnownNat j, Offsetable ty i, Offsetable ty j) => BlockN n ty -> BlockN (j - i) ty
- Basement.Sized.Block: uncons :: forall n ty. (CmpNat 0 n ~ 'LT, PrimType ty, KnownNat n, Offsetable ty n) => BlockN n ty -> (ty, BlockN (n - 1) ty)
+ Basement.Sized.Block: uncons :: forall n ty. (CmpNat 0 n ~ 'LT, PrimType ty, KnownNat n, Offsetable ty n) => BlockN n ty -> (ty, BlockN (n - 1) ty)
- Basement.Sized.Block: unsnoc :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, PrimType ty, Offsetable ty n) => BlockN n ty -> (BlockN (n - 1) ty, ty)
+ Basement.Sized.Block: unsnoc :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, PrimType ty, Offsetable ty n) => BlockN n ty -> (BlockN (n - 1) ty, ty)
- Basement.Sized.List: indexStatic :: forall i n a. (KnownNat i, CmpNat i n ~ 'LT, Offsetable a i) => ListN n a -> a
+ Basement.Sized.List: indexStatic :: forall i n a. (KnownNat i, CmpNat i n ~ 'LT, Offsetable a i) => ListN n a -> a
- Basement.Sized.UVect: intersperse :: (CmpNat n 1 ~ 'GT, PrimType ty) => ty -> UVect n ty -> UVect ((n + n) - 1) ty
+ Basement.Sized.UVect: intersperse :: (CmpNat n 1 ~ 'GT, PrimType ty) => ty -> UVect n ty -> UVect ((n + n) - 1) ty
- Basement.Sized.UVect: splitAt :: forall i n ty. (CmpNat i n ~ 'LT, PrimType ty, KnownNat i, Countable ty i) => UVect n ty -> (UVect i ty, UVect (n - i) ty)
+ Basement.Sized.UVect: splitAt :: forall i n ty. (CmpNat i n ~ 'LT, PrimType ty, KnownNat i, Countable ty i) => UVect n ty -> (UVect i ty, UVect (n - i) ty)
- Basement.Sized.UVect: sub :: forall i j n ty. ((i <=? n) ~ 'True, (j <=? n) ~ 'True, (i <=? j) ~ 'True, PrimType ty, KnownNat i, KnownNat j, Offsetable ty i, Offsetable ty j) => UVect n ty -> UVect (j - i) ty
+ Basement.Sized.UVect: sub :: forall i j n ty. ((i <=? n) ~ 'True, (j <=? n) ~ 'True, (i <=? j) ~ 'True, PrimType ty, KnownNat i, KnownNat j, Offsetable ty i, Offsetable ty j) => UVect n ty -> UVect (j - i) ty
- Basement.Sized.UVect: uncons :: forall n ty. (CmpNat 0 n ~ 'LT, PrimType ty, KnownNat n, Offsetable ty n) => UVect n ty -> (ty, UVect (n - 1) ty)
+ Basement.Sized.UVect: uncons :: forall n ty. (CmpNat 0 n ~ 'LT, PrimType ty, KnownNat n, Offsetable ty n) => UVect n ty -> (ty, UVect (n - 1) ty)
- Basement.Sized.UVect: unsnoc :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, PrimType ty, Offsetable ty n) => UVect n ty -> (UVect (n - 1) ty, ty)
+ Basement.Sized.UVect: unsnoc :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, PrimType ty, Offsetable ty n) => UVect n ty -> (UVect (n - 1) ty, ty)
- Basement.Sized.Vect: intersperse :: CmpNat n 1 ~ 'GT => ty -> Vect n ty -> Vect ((n + n) - 1) ty
+ Basement.Sized.Vect: intersperse :: CmpNat n 1 ~ 'GT => ty -> Vect n ty -> Vect ((n + n) - 1) ty
- Basement.Sized.Vect: splitAt :: forall i n ty. (CmpNat i n ~ 'LT, KnownNat i, Countable ty i) => Vect n ty -> (Vect i ty, Vect (n - i) ty)
+ Basement.Sized.Vect: splitAt :: forall i n ty. (CmpNat i n ~ 'LT, KnownNat i, Countable ty i) => Vect n ty -> (Vect i ty, Vect (n - i) ty)
- Basement.Sized.Vect: sub :: forall i j n ty. ((i <=? n) ~ 'True, (j <=? n) ~ 'True, (i <=? j) ~ 'True, KnownNat i, KnownNat j, Offsetable ty i, Offsetable ty j) => Vect n ty -> Vect (j - i) ty
+ Basement.Sized.Vect: sub :: forall i j n ty. ((i <=? n) ~ 'True, (j <=? n) ~ 'True, (i <=? j) ~ 'True, KnownNat i, KnownNat j, Offsetable ty i, Offsetable ty j) => Vect n ty -> Vect (j - i) ty
- Basement.Sized.Vect: uncons :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, Offsetable ty n) => Vect n ty -> (ty, Vect (n - 1) ty)
+ Basement.Sized.Vect: uncons :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, Offsetable ty n) => Vect n ty -> (ty, Vect (n - 1) ty)
- Basement.Sized.Vect: unsnoc :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, Offsetable ty n) => Vect n ty -> (Vect (n - 1) ty, ty)
+ Basement.Sized.Vect: unsnoc :: forall n ty. (CmpNat 0 n ~ 'LT, KnownNat n, Offsetable ty n) => Vect n ty -> (Vect (n - 1) ty, ty)
- Basement.Types.OffsetSize: sentinel :: () => Offset ty
+ Basement.Types.OffsetSize: sentinel :: Offset ty
- Basement.Types.Ptr: castPtr :: () => Ptr a -> Ptr b
+ Basement.Types.Ptr: castPtr :: Ptr a -> Ptr b
Files
- Basement/BoxedArray.hs +1/−0
- Basement/Compat/Primitive.hs +3/−1
- Basement/FinalPtr.hs +9/−9
- Basement/Monad.hs +1/−0
- Basement/Numerical/Additive.hs +7/−0
- Basement/String.hs +1/−1
- basement.cabal +1/−1
Basement/BoxedArray.hs view
@@ -86,6 +86,7 @@ import qualified Basement.Alg.Mutable as Alg import Basement.Compat.MonadTrans import Basement.Compat.Semigroup+import Basement.Compat.Primitive import Basement.Types.OffsetSize import Basement.PrimType import Basement.NormalForm
Basement/Compat/Primitive.hs view
@@ -15,6 +15,7 @@ , compatMkWeak# , compatIsByteArrayPinned# , compatIsMutableByteArrayPinned#+ , unsafeCoerce# , Word(..) ) where @@ -26,7 +27,8 @@ import Basement.Compat.PrimTypes --- GHC 8.8 | Base 4.13+-- GHC 9.0 | Base 4.15+-- GHC 8.8 | Base 4.13 4.14 -- GHC 8.6 | Base 4.12 -- GHC 8.4 | Base 4.11 -- GHC 8.2 | Base 4.10
Basement/FinalPtr.hs view
@@ -25,7 +25,7 @@ ) where import GHC.Ptr-import GHC.ForeignPtr+import qualified GHC.ForeignPtr as GHCF import GHC.IO import Basement.Monad import Basement.Compat.Primitive@@ -35,7 +35,7 @@ -- | Create a pointer with an associated finalizer data FinalPtr a = FinalPtr (Ptr a)- | FinalForeign (ForeignPtr a)+ | FinalForeign (GHCF.ForeignPtr a) instance Show (FinalPtr a) where show f = runST $ withFinalPtr f (pure . show) instance Eq (FinalPtr a) where@@ -50,7 +50,7 @@ -- same address, they should be the same final ptr finalPtrSameMemory :: FinalPtr a -> FinalPtr b -> Bool finalPtrSameMemory (FinalPtr p1) (FinalPtr p2) = p1 == castPtr p2-finalPtrSameMemory (FinalForeign p1) (FinalForeign p2) = p1 == castForeignPtr p2+finalPtrSameMemory (FinalForeign p1) (FinalForeign p2) = p1 == GHCF.castForeignPtr p2 finalPtrSameMemory (FinalForeign _) (FinalPtr _) = False finalPtrSameMemory (FinalPtr _) (FinalForeign _) = False @@ -62,17 +62,17 @@ case compatMkWeak# ptr () (finalizer ptr) s of { (# s2, _ #) -> (# s2, FinalPtr ptr #) } -- | Create a new FinalPtr from a ForeignPtr-toFinalPtrForeign :: ForeignPtr a -> FinalPtr a+toFinalPtrForeign :: GHCF.ForeignPtr a -> FinalPtr a toFinalPtrForeign fptr = FinalForeign fptr -- | Cast a finalized pointer from type a to type b castFinalPtr :: FinalPtr a -> FinalPtr b castFinalPtr (FinalPtr a) = FinalPtr (castPtr a)-castFinalPtr (FinalForeign a) = FinalForeign (castForeignPtr a)+castFinalPtr (FinalForeign a) = FinalForeign (GHCF.castForeignPtr a) withFinalPtrNoTouch :: FinalPtr p -> (Ptr p -> a) -> a withFinalPtrNoTouch (FinalPtr ptr) f = f ptr-withFinalPtrNoTouch (FinalForeign fptr) f = f (unsafeForeignPtrToPtr fptr)+withFinalPtrNoTouch (FinalForeign fptr) f = f (GHCF.unsafeForeignPtrToPtr fptr) {-# INLINE withFinalPtrNoTouch #-} -- | Looks at the raw pointer inside a FinalPtr, making sure the@@ -83,14 +83,14 @@ primTouch ptr pure r withFinalPtr (FinalForeign fptr) f = do- r <- f (unsafeForeignPtrToPtr fptr)- unsafePrimFromIO (touchForeignPtr fptr)+ r <- f (GHCF.unsafeForeignPtrToPtr fptr)+ unsafePrimFromIO (GHCF.touchForeignPtr fptr) pure r {-# INLINE withFinalPtr #-} touchFinalPtr :: PrimMonad prim => FinalPtr p -> prim () touchFinalPtr (FinalPtr ptr) = primTouch ptr-touchFinalPtr (FinalForeign fptr) = unsafePrimFromIO (touchForeignPtr fptr)+touchFinalPtr (FinalForeign fptr) = unsafePrimFromIO (GHCF.touchForeignPtr fptr) -- | Unsafe version of 'withFinalPtr' withUnsafeFinalPtr :: PrimMonad prim => FinalPtr p -> (Ptr p -> prim a) -> a
Basement/Monad.hs view
@@ -35,6 +35,7 @@ import GHC.IO import GHC.Prim import Basement.Compat.Base (Exception, (.), ($), Applicative, Monad)+import Basement.Compat.Primitive -- | Primitive monad that can handle mutation. --
Basement/Numerical/Additive.hs view
@@ -1,5 +1,7 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DefaultSignatures #-} {-# OPTIONS_GHC -fno-prof-auto #-}@@ -117,6 +119,7 @@ azero = 0 (+) = (Word256.+) scale = scaleNum+ instance Additive Prelude.Float where azero = 0.0 (F# a) + (F# b) = F# (a `plusFloat#` b)@@ -124,6 +127,10 @@ instance Additive Prelude.Double where azero = 0.0 (D# a) + (D# b) = D# (a +## b)+ scale = scaleNum+instance Additive Prelude.Rational where+ azero = 0.0+ (+) = (Prelude.+) scale = scaleNum instance (KnownNat n, NatWithinBound Word64 n) => Additive (Zn64 n) where
Basement/String.hs view
@@ -813,7 +813,7 @@ where !(C.ValidRange start end) = C.offsetsValidRange arr --- Finds where are the insertion points when we search for a `needle`+-- | Finds where are the insertion points when we search for a `needle` -- within an `haystack`. indices :: String -> String -> [Offset8] indices (String ned) (String hy) = Vec.indices ned hy
basement.cabal view
@@ -1,5 +1,5 @@ name: basement-version: 0.0.11+version: 0.0.12 synopsis: Foundation scrap box of array & string description: Foundation most basic primitives without any dependencies license: BSD3