packages feed

strict-base-types 0.6.1 → 0.7

raw patch · 5 files changed

+73/−734 lines, 5 filesdep +quickcheck-instancesdep +strict-lensdep −QuickCheckdep −bifunctorsdep −binarydep ~aesondep ~basedep ~strictnew-uploader

Dependencies added: quickcheck-instances, strict-lens

Dependencies removed: QuickCheck, bifunctors, binary, deepseq, ghc-prim, hashable, lens, semigroups

Dependency ranges changed: aeson, base, strict

Files

CHANGES view
@@ -1,3 +1,13 @@+* 0.7+  - `strict-base-types` contents have been migrated to+      - `strict >=0.4`+      - `quickcheck-instances >=0.3.24`+      - `aeson >=1.5.3.0`+      - or `strict-lens >=0.4`++    This version has similar exposed API as 0.6.1,+    but we recommend to start using them directly (by specifying lower bounds).+ * 0.6.1   - Add contributions by Oleg Grenrus (@phadej)     - Make 'Semigroup' instances available on all `base` versions.
src/Data/Either/Strict.hs view
@@ -24,7 +24,7 @@ -- ----------------------------------------------------------------------------- module Data.Either.Strict (-    Either(Left, Right)+    Either(..)   , isRight   , isLeft   , either@@ -35,190 +35,8 @@   , _Right ) where -import           Data.Strict.Either  (Either (Left, Right), either, isLeft,-                                      isRight)-import           Prelude             hiding (Either (..), either)-import qualified Prelude             as L--import           Control.DeepSeq     (NFData (..))-import           Control.Lens.Iso    (Strict (..), Swapped (..), iso)-import           Control.Lens.Prism  (Prism, prism)-import           Data.Aeson          (FromJSON (..), ToJSON (..))-import           Data.Bifoldable     (Bifoldable (..))-import           Data.Bifunctor      (Bifunctor (..))-import           Data.Binary         (Binary (..))-import           Data.Bitraversable  (Bitraversable (..))-#if MIN_VERSION_base(4,7,0)-import           Data.Data           (Data (..), Typeable)-#else-import           Data.Data           (Data (..), Typeable2 (..))-#endif-#if !MIN_VERSION_base(4,8,0)-import           Control.Applicative (pure, (<$>))-import           Data.Foldable       (Foldable (..))-import           Data.Traversable    (Traversable (..))-import           Data.Monoid         (Monoid (..))-#endif-#if __GLASGOW_HASKELL__ >= 706-import           GHC.Generics        (Generic (..))-#endif-import           Test.QuickCheck     (Arbitrary (..))-import           Data.Hashable       (Hashable(..))----- Utilities--------------toStrict :: L.Either a b -> Either a b-toStrict (L.Left x)  = Left x-toStrict (L.Right y) = Right y--toLazy :: Either a b -> L.Either a b-toLazy (Left x)  = L.Left x-toLazy (Right y) = L.Right y----- missing instances-----------------------deriving instance (Data a, Data b) => Data     (Either a b)-#if MIN_VERSION_base(4,7,0)-deriving instance Typeable Either-#else-deriving instance Typeable2 Either-#endif--#if __GLASGOW_HASKELL__ >= 706-deriving instance Generic  (Either a b)-#endif--instance Foldable (Either e) where-  foldr _ y (Left _)  = y-  foldr f y (Right x) = f x y--  foldl _ y (Left _)  = y-  foldl f y (Right x) = f y x--instance Traversable (Either e) where-  traverse _ (Left x)  = pure (Left x)-  traverse f (Right x) = Right <$> f x----- deepseq-instance (NFData a, NFData b) => NFData (Either a b) where-  rnf = rnf . toLazy---- binary-instance (Binary a, Binary b) => Binary (Either a b) where-  put = put . toLazy-  get = toStrict <$> get---- aeson-instance (ToJSON a, ToJSON b) => ToJSON (Either a b) where-  toJSON = toJSON . toLazy--instance (FromJSON a, FromJSON b) => FromJSON (Either a b) where-  parseJSON val = toStrict <$> parseJSON val---- quickcheck-instance (Arbitrary a, Arbitrary b) => Arbitrary (Either a b) where-  arbitrary = toStrict <$> arbitrary-  shrink    = map toStrict . shrink . toLazy---- bifunctors--instance Bifunctor Either where-  bimap f _ (Left a) = Left (f a)-  bimap _ g (Right a) = Right (g a)-  first f = either (Left . f) Right-  second g = either Left (Right . g)--instance Bifoldable Either where-  bifold (Left a) = a-  bifold (Right b) = b-  bifoldMap = either-  bifoldr f _ c (Left a) = f a c-  bifoldr _ g c (Right b) = g b c-  bifoldl f _ c (Left a) = f c a-  bifoldl _ g c (Right b) = g c b--instance Bitraversable Either where-  bitraverse f _ (Left a) = fmap Left (f a)-  bitraverse _ g (Right b) = fmap Right (g b)-#if !MIN_VERSION_bifunctors(5,1,0)-  bisequenceA = either (fmap Left) (fmap Right)-#endif---- lens-instance Strict (L.Either a b) (Either a b) where-  strict = iso toStrict toLazy--instance Swapped Either where-  swapped = either Right Left `iso` either Right Left---- hashable-instance (Hashable a, Hashable b) => Hashable (Either a b) where-  hashWithSalt salt = hashWithSalt salt . toLazy---- missing functions------------------------- | Analogous to 'L.lefts' in "Data.Either".-lefts   :: [Either a b] -> [a]-lefts x = [a | Left a <- x]---- | Analogous to 'L.rights' in "Data.Either".-rights   :: [Either a b] -> [b]-rights x = [a | Right a <- x]---- | Analogous to 'L.partitionEithers' in "Data.Either".-partitionEithers :: [Either a b] -> ([a],[b])-partitionEithers =-    Prelude.foldr (either left right) ([],[])-  where-    left  a ~(l, r) = (a:l, r)-    right a ~(l, r) = (l, a:r)---- | Analogous to 'Control.Lens.Prism._Left' in "Control.Lens.Prism".-_Left :: Prism (Either a c) (Either b c) a b-_Left = prism Left $ either L.Right (L.Left . Right)---- | Analogous to 'Control.Lens.Prism._Right' in "Control.Lens.Prism".-_Right :: Prism (Either c a) (Either c b) a b-_Right = prism Right $ either (L.Left . Left) L.Right----------------------------------------------------------------------------------- Code required to make this module independent of the 'strict' package---------------------------------------------------------------------------------{---- | The strict choice type.------ Note that this type is not an applicative functor, and therefore also no--- monad. The reasons are the same as the ones explained in the documentation--- of the strict 'Data.Strict.Maybe.Maybe' type.-data Either a b = Left !a | Right !b-    deriving(Eq, Ord, Read, Show)--}--{--instance Functor (Either a) where-  fmap f  = toStrict . fmap f . toLazy---- | Analogous to 'L.either' in "Data.Either".-either :: (a -> c) -> (b -> c) -> Either a b -> c-either f g = L.either f g . toLazy--}--{---- | Analogous to 'L.isLeft' in "Data.Either", which will be included in base--- \> 4.6.-isLeft :: Either a b -> Bool-isLeft (Left  _) = True-isLeft (Right _) = False---- | Analogous to 'L.isRight' in "Data.Either", which will be included in base--- \> 4.6.-isRight :: Either a b -> Bool-isRight (Left  _) = False-isRight (Right _) = True--}+import Data.Aeson ()+import Data.Strict.Either  (Either (..), either, isLeft, isRight, lefts, rights, partitionEithers)+import Data.Strict.Lens (_Left, _Right)+import Prelude ()+import Test.QuickCheck.Instances.Strict ()
src/Data/Maybe/Strict.hs view
@@ -31,7 +31,7 @@ -----------------------------------------------------------------------------  module Data.Maybe.Strict (-     Maybe(Nothing,Just)+     Maybe(..)    , maybe     , isJust@@ -46,209 +46,8 @@    , _Nothing ) where -import           Data.Strict.Maybe   (Maybe (Nothing, Just), fromJust,-                                      fromMaybe, isJust, isNothing, maybe)-import           Prelude             hiding (Maybe (..), maybe)-import qualified Prelude             as L--import           Control.DeepSeq     (NFData (..))-import           Control.Lens.Iso    (Strict (..), iso)-import           Control.Lens.Prism  (Prism, Prism', prism, prism')-import           Data.Aeson          (FromJSON (..), ToJSON (..))-import           Data.Binary         (Binary (..))-#if MIN_VERSION_base(4,7,0)-import           Data.Data           (Data (..), Typeable)-#else-import           Data.Data           (Data (..), Typeable1 (..))-#endif-#if !MIN_VERSION_base(4,8,0)-import           Control.Applicative (pure, (<$>))-import           Data.Foldable       (Foldable (..))-import           Data.Traversable    (Traversable (..))-import           Data.Monoid         (Monoid (..))-#endif-#if __GLASGOW_HASKELL__ >= 706-import           GHC.Generics        (Generic (..))-#endif-import           Test.QuickCheck     (Arbitrary (..))-import           Data.Hashable       (Hashable(..))-import           Data.Semigroup      (Semigroup)-import qualified Data.Semigroup      as Semigroup----- utilities---------------toStrict :: L.Maybe a -> Maybe a-toStrict L.Nothing  = Nothing-toStrict (L.Just x) = Just x--toLazy :: Maybe a -> L.Maybe a-toLazy Nothing  = L.Nothing-toLazy (Just x) = L.Just x--deriving instance Data a => Data (Maybe a)-#if MIN_VERSION_base(4,7,0)-deriving instance Typeable Maybe-#else-deriving instance Typeable1 Maybe-#endif--#if __GLASGOW_HASKELL__ >= 706-deriving instance Generic  (Maybe a)-#endif--instance Semigroup a => Semigroup (Maybe a) where-  Nothing <> m       = m-  m       <> Nothing = m-  Just x1 <> Just x2 = Just (x1 Semigroup.<> x2)--#if MIN_VERSION_base(4,11,0)-instance Semigroup a => Monoid (Maybe a) where-  mempty = Nothing-#else-instance Monoid a => Monoid (Maybe a) where-  mempty = Nothing--  Nothing `mappend` m       = m-  m       `mappend` Nothing = m-  Just x1 `mappend` Just x2 = Just (x1 `mappend` x2)-#endif---- foldable-instance Foldable Maybe where-    foldMap _ Nothing  = mempty-    foldMap f (Just x) = f x---- traversable-instance Traversable Maybe where-    traverse _ Nothing  = pure Nothing-    traverse f (Just x) = Just <$> f x---- deepseq-instance NFData a => NFData (Maybe a) where-  rnf = rnf . toLazy---- binary-instance Binary a => Binary (Maybe a) where-  put = put . toLazy-  get = toStrict <$> get---- aeson-instance ToJSON a => ToJSON (Maybe a) where-  toJSON = toJSON . toLazy--instance FromJSON a => FromJSON (Maybe a) where-  parseJSON val = toStrict <$> parseJSON val---- quickcheck-instance Arbitrary a => Arbitrary (Maybe a) where-  arbitrary = toStrict <$> arbitrary-  shrink    = map toStrict . shrink . toLazy---- lens-instance Strict (L.Maybe a) (Maybe a) where-  strict = iso toStrict toLazy---- hashable-instance Hashable a => Hashable (Maybe a) where-  hashWithSalt salt = hashWithSalt salt . toLazy---- | Analogous to 'L.listToMaybe' in "Data.Maybe".-listToMaybe :: [a] -> Maybe a-listToMaybe []        =  Nothing-listToMaybe (a:_)     =  Just a---- | Analogous to 'L.maybeToList' in "Data.Maybe".-maybeToList :: Maybe a -> [a]-maybeToList  Nothing   = []-maybeToList  (Just x)  = [x]---- | Analogous to 'L.catMaybes' in "Data.Maybe".-catMaybes :: [Maybe a] -> [a]-catMaybes ls = [x | Just x <- ls]---- | Analogous to 'L.mapMaybe' in "Data.Maybe".-mapMaybe :: (a -> Maybe b) -> [a] -> [b]-mapMaybe _ []     = []-mapMaybe f (x:xs) = case f x of-    Nothing -> rs-    Just r  -> r:rs-  where-    rs = mapMaybe f xs---- | Analogous to 'Control.Lens.Prism._Just' in "Control.Lens.Prism"-_Just :: Prism (Maybe a) (Maybe b) a b-_Just = prism Just $ maybe (Left Nothing) Right---- | Analogous to 'Control.Lens.Prism._Nothing' in "Control.Lens.Prism"-_Nothing :: Prism' (Maybe a) ()-_Nothing = prism' (const Nothing) $ maybe (L.Just ()) (const L.Nothing)----------------------------------------------------------------------------------- Code required to make this module independent of the 'strict' package---------------------------------------------------------------------------------{---- | The type of strict optional values.------ In contrast to the standard lazy 'L.Maybe' type, this type is not an--- applicative functor, and therefore also not a monad. The problem is the--- /homomorphism/ law, which states that------      @'pure' f '<*>' 'pure' x = 'pure' (f x)@------ must hold for all @f@. This law does not hold for the expected applicative--- functor instance of 'Maybe', as this instance does not satisfy @pure f--- \<*\> pure _|_ = pure (f _|_)@ for @f = const@.-data Maybe a = Nothing | Just !a-    deriving(Eq, Ord, Show, Read, Data, Typeable, Generic)--}---- instances---------------{--instance StrictType (Maybe a) where-  type LazyVariant (Maybe a) = L.Maybe a--  toStrict L.Nothing  = Nothing-  toStrict (L.Just x) = Just x--  toLazy Nothing  = L.Nothing-  toLazy (Just x) = L.Just x--instance Functor Maybe where-  fmap f = toStrict . fmap f . toLazy--instance Foldable Maybe where-  foldr f y  = Foldable.foldr f y . toLazy-  foldl f y  = Foldable.foldl f y . toLazy--instance Traversable Maybe where-  traverse _ Nothing  = pure Nothing-  traverse f (Just x) = Just <$> f x--}--{---- | Analogous to 'L.isJust' in "Data.Maybe".-isJust :: Maybe a -> Bool-isJust = L.isJust . toLazy---- | Analogous to 'L.isNothing' in "Data.Maybe".-isNothing :: Maybe a -> Bool-isNothing = L.isNothing . toLazy---- | Analogous to 'L.fromJust' in "Data.Maybe".-fromJust :: Maybe a -> a-fromJust Nothing  = error "Data.Strict.Maybe.fromJust: Nothing"-fromJust (Just x) = x---- | Analogous to 'L.fromMaybe' in "Data.Maybe".-fromMaybe :: a -> Maybe a -> a-fromMaybe x = L.fromMaybe x . toLazy---- | Analogous to 'L.maybe' in "Data.Maybe".-maybe :: b -> (a -> b) -> Maybe a -> b-maybe x f = L.maybe x f . toLazy--}+import Data.Aeson ()+import Data.Strict.Lens (_Just, _Nothing)+import Data.Strict.Maybe   (Maybe (..), fromJust, fromMaybe, isJust, isNothing, maybe, listToMaybe, maybeToList, mapMaybe, catMaybes)+import Prelude ()+import Test.QuickCheck.Instances.Strict ()
src/Data/Tuple/Strict.hs view
@@ -22,7 +22,6 @@ -- ----------------------------------------------------------------------------- - module Data.Tuple.Strict (     Pair(..)   , fst@@ -34,209 +33,8 @@   , unzip ) where -import           Data.Strict.Tuple   (Pair ((:!:)), curry, fst, snd, uncurry)-import           Prelude             hiding (curry, fst, snd, uncurry, unzip,-                                      zip)--import           Control.DeepSeq     (NFData (..))--#if MIN_VERSION_lens(4,0,0)-import           Control.Lens.At     (Index)-import           Control.Lens.Each   (Each(..))-#else-import           Control.Lens.Each   (Index, Each(..))-#endif--import           Control.Lens.Iso    (Strict (..), Swapped (..), iso)-import           Control.Lens.Indexed (indexed)-import           Control.Lens.Operators ((<&>))-import           Control.Lens.Tuple  (Field1 (..), Field2 (..))-import           Data.Aeson          (FromJSON (..), ToJSON (..))-import           Data.Bifoldable     (Bifoldable (..))-import           Data.Bifunctor      (Bifunctor (..))-import           Data.Bitraversable  (Bitraversable (..))-import           Data.Binary         (Binary (..))-#if MIN_VERSION_base(4,7,0)-import           Data.Data           (Data (..), Typeable)-#else-import           Data.Data           (Data (..), Typeable2 (..))-#endif-#if !MIN_VERSION_base(4,8,0)-import           Control.Applicative (Applicative ((<*>)), (<$>))-import           Data.Foldable       (Foldable (..))-import           Data.Traversable    (Traversable (..))-import           Data.Monoid         (Monoid (..))-#endif-#if __GLASGOW_HASKELL__ >= 706-import           GHC.Generics        (Generic (..))-#endif-import           Test.QuickCheck     (Arbitrary (..))-import           Data.Hashable       (Hashable(..))-import           Data.Semigroup      (Semigroup (..))--#if __HADDOCK__-import Data.Tuple ()-#endif---- Utilities---------------toStrict :: (a, b) -> Pair a b-toStrict (a, b) = a :!: b--toLazy :: Pair a b -> (a, b)-toLazy (a :!: b) = (a, b)----- missing instances-----------------------deriving instance (Data a, Data b) => Data     (Pair a b)-#if MIN_VERSION_base(4,7,0)-deriving instance Typeable Pair-#else-deriving instance Typeable2 Pair-#endif---- fails with compiler panic on GHC 7.4.2-#if __GLASGOW_HASKELL__ >= 706-deriving instance Generic  (Pair a b)-#endif--instance Functor (Pair e) where-    fmap f = toStrict . fmap f . toLazy--instance Foldable (Pair e) where-  foldMap f (_ :!: x) = f x--instance Traversable (Pair e) where-  traverse f (e :!: x) = (:!:) e <$> f x--instance (Semigroup a, Semigroup b) => Semigroup (Pair a b) where-  (x1 :!: y1) <> (x2 :!: y2) = (x1 <> x2) :!: (y1 <> y2)--instance (Monoid a, Monoid b) => Monoid (Pair a b) where-  mempty                            = mempty :!: mempty-  (x1 :!: y1) `mappend` (x2 :!: y2) = (x1 `mappend` x2) :!: (y1 `mappend` y2)---- deepseq-instance (NFData a, NFData b) => NFData (Pair a b) where-  rnf = rnf . toLazy---- binary-instance (Binary a, Binary b) => Binary (Pair a b) where-  put = put . toLazy-  get = toStrict <$> get---- aeson-instance (ToJSON a, ToJSON b) => ToJSON (Pair a b) where-  toJSON = toJSON . toLazy--instance (FromJSON a, FromJSON b) => FromJSON (Pair a b) where-  parseJSON val = toStrict <$> parseJSON val---- quickcheck-instance (Arbitrary a, Arbitrary b) => Arbitrary (Pair a b) where-  arbitrary = toStrict <$> arbitrary-  shrink    = map toStrict . shrink . toLazy---- bifunctors-instance Bifunctor Pair where-  bimap f g (a :!: b) = f a :!: g b-  first f (a :!: b) = f a :!: b-  second g (a :!: b) = a :!: g b--instance Bifoldable Pair where-  bifold (a :!: b) = a `mappend` b-  bifoldMap f g (a :!: b) = f a `mappend` g b-  bifoldr f g c (a :!: b) = g b (f a c)-  bifoldl f g c (a :!: b) = g (f c a) b--instance Bitraversable Pair where-  bitraverse f g (a :!: b) = (:!:) <$> f a <*> g b-#if !MIN_VERSION_bifunctors(5,1,0)-  bisequenceA (a :!: b) = (:!:) <$> a <*> b-#endif---- lens-instance Strict (a, b) (Pair a b) where-  strict = iso toStrict toLazy--instance Field1 (Pair a b) (Pair a' b) a a' where-  _1 k (a :!: b) = indexed k (0 :: Int) a <&> \a' -> (a' :!: b)--instance Field2 (Pair a b) (Pair a b') b b' where-  _2 k (a :!: b) = indexed k (1 :: Int) b <&> \b' -> (a :!: b')--instance Swapped Pair where-  swapped = iso swap swap---type instance Index (Pair a b) = Int--#if MIN_VERSION_lens(4,0,0)-instance (a~a', b~b') => Each (Pair a a') (Pair b b') a b where-  each f ~(a :!: b) = (:!:) <$> f a <*> f b-  {-# INLINE each #-}-#else-instance (Applicative f, a~a', b~b') => Each f (Pair a a') (Pair b b') a b where-  each f (a :!: b) = (:!:) <$> indexed f (0::Int) a <*> indexed f (1::Int) b-  {-# INLINE each #-}-#endif---- hashable-instance (Hashable a, Hashable b) => Hashable (Pair a b) where-  hashWithSalt salt = hashWithSalt salt . toLazy----- missing functions------------------------- | Analagous to 'L.swap' from "Data.Tuple"-swap :: Pair a b -> Pair b a-swap (a :!: b) = b :!: a---- | Zip for strict pairs (defined with zipWith).-zip :: [a] -> [b] -> [Pair a b]-zip x y = zipWith (:!:) x y---- | Unzip for stict pairs into a (lazy) pair of lists.-unzip :: [Pair a b] -> ([a], [b])-unzip x = ( map fst x-          , map snd x-          )----------------------------------------------------------------------------------- Code required to make this module independent of the 'strict' package---------------------------------------------------------------------------------{---- | The type of strict pairs. Note that------ > (x :!: _|_) = (_|_ :!: y) = _|_-data Pair a b = !a :!: !b-    deriving(Eq, Ord, Show, Read, Bounded, Ix, Data, Typeable, Generic)--instance StrictType (Pair a b) where-    type LazyVariant (Pair a b) = (a, b)--    toStrict (a, b)    = a :!: b-    toLazy   (a :!: b) = (a, b)---- | Extract the first component of a strict pair.-fst :: Pair a b -> a-fst (x :!: _) = x---- | Extract the second component of a strict pair.-snd :: Pair a b -> b-snd (_ :!: y) = y---- | Curry a function on strict pairs.-curry :: (Pair a b -> c) -> a -> b -> c-curry f x y = f (x :!: y)---- | Convert a curried function to a function on strict pairs.-uncurry :: (a -> b -> c) -> Pair a b -> c-uncurry f (x :!: y) = f x y--}-+import Data.Aeson ()+import Data.Strict.Lens ()+import Data.Strict.Tuple (Pair (..), curry, fst, snd, uncurry, swap, unzip, zip)+import Prelude ()+import Test.QuickCheck.Instances.Strict ()
strict-base-types.cabal view
@@ -1,143 +1,57 @@-Name:           strict-base-types-Version:        0.6.1-Synopsis:       Strict variants of the types provided in base.-Category:       Data-Description:-     It is common knowledge that lazy datastructures can lead to space-leaks.-     This problem is particularly prominent, when using lazy datastructures to-     store the state of a long-running application in memory. The easiest-     solution to this problem is to use fully strict types to store such state-     values. By \"fully strict types\" we mean types for whose values it holds-     that, if they are in weak-head normal form, then they are also in normal-     form. Intuitively, this means that values of fully strict types cannot-     contain unevaluated thunks.-     .-     To define a fully strict datatype, one typically uses the following recipe.-     .-     1. Make all fields of every constructor strict; i.e., add a bang to-        all fields.-     .-     2. Use only strict types for the fields of the constructors.-     .-     The second requirement is problematic as it rules out the use of-     the standard Haskell 'Maybe', 'Either', and pair types. This library-     solves this problem by providing strict variants of these types and their-     corresponding standard support functions and type-class instances.-     .-     Note that this library does currently not provide fully strict lists.-     They can be added if they are really required. However, in many cases one-     probably wants to use unboxed or strict boxed vectors from the 'vector'-     library (<http://hackage.haskell.org/package/vector>) instead of strict-     lists.  Moreover, instead of @String@s one probably wants to use strict-     @Text@ values from the @text@ library-     (<http://hackage.haskell.org/package/text>).-     .-     This library comes with batteries included; i.e., missing instances-     for type-classes from the @deepseq@, @binary@, @aeson@, @QuickCheck@, and-     @lens@ packages are included. Of particluar interest is the @Strict@-     type-class provided by the lens library-     (<http://hackage.haskell.org/packages/archive/lens/3.9.0.2/doc/html/Control-Lens-Iso.html#t:Strict>).-     It is used in the following example to simplify the modification of-     strict fields.-     .-     > (-# LANGUAGE TemplateHaskell #-)   -- replace with curly braces,-     > (-# LANGUAGE OverloadedStrings #-) -- the Haddock prologues are a P.I.T.A!-     >-     > import           Control.Lens ( (.=), Strict(strict), from, Iso', makeLenses)-     > import           Control.Monad.State.Strict (State)-     > import qualified Data.Map                   as M-     > import qualified Data.Maybe.Strict          as S-     > import qualified Data.Text                  as T-     >-     > -- | An example of a state record as it could be used in a (very minimal)-     > -- role-playing game.-     > data GameState = GameState-     >     ( _gsCooldown :: !(S.Maybe Int)-     >     , _gsHealth   :: !Int-     >     )  -- replace with curly braces, *grmbl*-     >-     > makeLenses ''GameState-     >-     > -- The isomorphism, which converts a strict field to its lazy variant-     > lazy :: Strict lazy strict => Iso' strict lazy-     > lazy = from strict-     >-     > type Game = State GameState-     >-     > cast :: T.Text -> Game ()-     > cast spell =-     >     gsCooldown.lazy .= M.lookup spell spellDuration-     >     -- ... implement remainder of spell-casting ...-     >   where-     >     spellDuration = M.fromList [("fireball", 5)]-     .-     See-     <http://www.haskellforall.com/2013/05/program-imperatively-using-haskell.html>-     for a gentle introduction to lenses and state manipulation.-     .-     Note that this package uses the types provided by the 'strict' package-     (<http://hackage.haskell.org/package/strict>), but organizes them a bit-     differently. More precisely, the @strict-base-types@ package-     .-     - only provides the fully strict variants of types from 'base',-     .-     - is in-sync with the current base library (base-4.6),-     .-     - provides the missing instances for (future) Haskell platform packages, and-     .-     - conforms to the standard policy that strictness variants of an existing-       datatype are identified by suffixing \'Strict\' or \'Lazy\' in the-       module hierarchy.+name:               strict-base-types+version:            0.7+synopsis:           Strict variants of the types provided in base.+category:           Data+description:+  Since version 0.7 the functionality in this package+  have been merged into `strict`, `aeson` and `quickcheck-instances`+  packages, and lens functionality moved into `strict-lens` package. +license:            BSD3+license-file:       LICENSE+author:+  Roman Leshchinskiy <rl@cse.unsw.edu.au>,+  Simon Meier <iridcode@gmail.com> -License:        BSD3-License-File:   LICENSE-Author:         Roman Leshchinskiy <rl@cse.unsw.edu.au>,-                Simon Meier <iridcode@gmail.com>-Maintainer:     Simon Meier <iridcode@gmail.com>-Copyright:      (c) 2006-2008 by Roman Leshchinskiy-                (c) 2013-2014 by Simon Meier-Homepage:       https://github.com/meiersi/strict-base-types-Cabal-Version: >= 1.6-Build-type:     Simple-Tested-with:-  GHC==7.4.2,-  GHC==7.6.3,-  GHC==7.8.4,-  GHC==7.10.3,-  GHC==8.0.2,-  GHC==8.2.2,-  GHC==8.4.1+maintainer:+  Bas van Dijk <v.dijk.bas@gmail.com>, Oleg Grenrus <oleg.grenrus@iki.fi>, Simon Meier <iridcode@gmail.com> -extra-source-files:-  CHANGES+copyright:+  (c) 2006-2008 by Roman Leshchinskiy+  (c) 2013-2014 by Simon Meier +homepage:           https://github.com/haskell-strict/strict+cabal-version:      >=1.10+build-type:         Simple+tested-with:+  GHC ==7.8.4+   || ==7.10.3+   || ==8.0.2+   || ==8.2.2+   || ==8.4.4+   || ==8.6.5+   || ==8.8.3+   || ==8.10.1++extra-source-files: CHANGES+ source-repository head   type:     git-  location: https://github.com/meiersi/strict-base-types.git+  location: https://github.com/haskell-strict/strict.git+  subdir:   strict-base-types  library-  ghc-options:    -Wall -fwarn-incomplete-uni-patterns-  if impl(ghc >= 8.0)-    ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances+  default-language: Haskell2010+  ghc-options:      -Wall   build-depends:-      base       >= 4.5 && < 5-    , lens       >= 3.9-    , QuickCheck >= 2-    , aeson      >= 0.6-    , binary     >= 0.5-    , deepseq    >= 1.3-    , hashable   >= 1.1.1.0-    , strict     >= 0.3.2 && <0.4-    , bifunctors >= 3.0-    , ghc-prim--  if !impl(ghc >= 8.0)-    build-depends: semigroups >= 0.18.3+      aeson                 >=1.5.3.0 && <1.6+    , base                  >=4.7     && <5+    , quickcheck-instances  >=0.3.24  && <0.4+    , strict                >=0.4     && <0.4.1+    , strict-lens           >=0.4     && <0.5 -  hs-source-dirs:    src+  hs-source-dirs:   src   exposed-modules:-      Data.Tuple.Strict-      Data.Maybe.Strict-      Data.Either.Strict-+    Data.Either.Strict+    Data.Maybe.Strict+    Data.Tuple.Strict