membrain 0.0.0.0 → 0.0.0.1
raw patch · 7 files changed
+50/−16 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Membrain.Memory: Memory :: Natural -> Memory
+ Membrain.Memory: Memory :: Natural -> Memory (mem :: Nat)
- Membrain.Memory: [unMemory] :: Memory -> Natural
+ Membrain.Memory: [unMemory] :: Memory (mem :: Nat) -> Natural
Files
- CHANGELOG.md +4/−0
- membrain.cabal +10/−6
- src/Membrain.hs +6/−1
- src/Membrain/Base.hs +4/−0
- src/Membrain/Constructors.hs +6/−1
- src/Membrain/Memory.hs +10/−4
- src/Membrain/Units.hs +10/−4
CHANGELOG.md view
@@ -3,6 +3,10 @@ `membrain` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 0.0.0.1 — 09 Feb, 2020++* Upgrade to GHC-8.8.2.+ ## 0.0.0.0 — 23 Jul, 2019 * Initially created.
membrain.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: membrain-version: 0.0.0.0+version: 0.0.0.1 synopsis: Type-safe memory units description: @membrain@ provides @newtype@ wrapper for type-safe work with memory units@@ -24,21 +24,22 @@ license-file: LICENSE author: Veronika Romashkina, Dmitrii Kovanikov maintainer: Kowainik <xrom.xkov@gmail.com>-copyright: 2018-2019 Kowainik+copyright: 2018-2020 Kowainik category: Memory, Safe build-type: Simple extra-doc-files: README.md- , CHANGELOG.md+ CHANGELOG.md tested-with: GHC == 8.2.2- , GHC == 8.4.4- , GHC == 8.6.5+ GHC == 8.4.4+ GHC == 8.6.5+ GHC == 8.8.2 source-repository head type: git location: https://github.com/kowainik/membrain.git common common-options- build-depends: base >= 4.10.1.0 && < 4.13+ build-depends: base >= 4.10.1.0 && < 4.14 ghc-options: -Wall -Wincomplete-uni-patterns@@ -49,6 +50,9 @@ -fhide-source-paths -Wmissing-export-lists -Wpartial-fields+ if impl(ghc >= 8.8.1)+ ghc-options: -Wmissing-deriving-strategies+ -Werror=missing-deriving-strategies default-language: Haskell2010 default-extensions: ConstraintKinds
src/Membrain.hs view
@@ -1,4 +1,9 @@-{- | Type-safe memory units. This package has the following structure:+{- |+Copyright: (c) 2018-2020 Kowainik+SPDX-License-Identifier: MPL-2.0+Maintainer: Kowainik <xrom.xkov@gmail.com>++Type-safe memory units. This package has the following structure: * __"Membrain.Memory":__ main 'Memory' data type with many utility functions. * __"Membrain.Units":__ type-level unit multipliers.
src/Membrain/Base.hs view
@@ -1,4 +1,8 @@ {- |+Copyright: (c) 2018-2020 Kowainik+SPDX-License-Identifier: MPL-2.0+Maintainer: Kowainik <xrom.xkov@gmail.com>+ This modules introduces more type-safe interface of some standard function to work with memory from @base@ package. -}
src/Membrain/Constructors.hs view
@@ -1,4 +1,9 @@-{- | This module implements smart constructors for creating values of type+{- |+Copyright: (c) 2018-2020 Kowainik+SPDX-License-Identifier: MPL-2.0+Maintainer: Kowainik <xrom.xkov@gmail.com>++This module implements smart constructors for creating values of type 'Memory'. -}
src/Membrain/Memory.hs view
@@ -3,11 +3,17 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE MagicHash #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-} -{- | This module contains 'Memory' data type and various utility functions:+{- |+Copyright: (c) 2018-2020 Kowainik+SPDX-License-Identifier: MPL-2.0+Maintainer: Kowainik <xrom.xkov@gmail.com> +This module contains 'Memory' data type and various utility functions:+ 1. Create values of type 'Memory'. 2. Unwrap values of type 'Memory' to integral types. 3. Pretty-displaying functions.@@ -46,11 +52,11 @@ import Data.Foldable (foldl') import Data.Kind (Type) import Data.List.NonEmpty (NonEmpty)-import Data.Proxy (Proxy (..)) import Data.Ratio (Ratio, (%)) import Data.Semigroup (Semigroup (..))+import GHC.Exts (Proxy#, proxy#) import GHC.Generics (Generic)-import GHC.TypeNats (KnownNat, Nat, natVal)+import GHC.TypeNats (KnownNat, Nat, natVal') import Numeric.Natural (Natural) import Membrain.Units (KnownUnitSymbol, unitSymbol)@@ -318,5 +324,5 @@ ---------------------------------------------------------------------------- nat :: forall (mem :: Nat) . KnownNat mem => Natural-nat = natVal (Proxy @mem)+nat = natVal' (proxy# :: Proxy# mem) {-# INLINE nat #-}
src/Membrain/Units.hs view
@@ -2,13 +2,19 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE MagicHash #-} {-# LANGUAGE TypeFamilyDependencies #-} {-# LANGUAGE TypeOperators #-} #if ( __GLASGOW_HASKELL__ >= 806 ) {-# LANGUAGE NoStarIsType #-} #endif -{- | This module contains type aliases for memory data units. According to the+{- |+Copyright: (c) 2018-2020 Kowainik+SPDX-License-Identifier: MPL-2.0+Maintainer: Kowainik <xrom.xkov@gmail.com>++This module contains type aliases for memory data units. According to the official standard, there exist two naming conventions for memory units. Standard measure prefixes are multipliers of @10@. But there are alternative prefixes which end with @bi@ and they are represented as powers of @2@. The difference@@ -59,8 +65,8 @@ , unitSymbol ) where -import Data.Proxy (Proxy (..))-import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)+import GHC.Exts (Proxy#, proxy#)+import GHC.TypeLits (KnownSymbol, Symbol, symbolVal') import GHC.TypeNats (type (*), Nat) @@ -137,5 +143,5 @@ "YiB" -} unitSymbol :: forall (mem :: Nat) . KnownUnitSymbol mem => String-unitSymbol = symbolVal $ Proxy @(UnitSymbol mem)+unitSymbol = symbolVal' (proxy# :: Proxy# (UnitSymbol mem)) {-# INLINE unitSymbol #-}