sdp-deepseq (empty) → 0.2
raw patch · 3 files changed
+140/−0 lines, 3 filesdep +basedep +deepseqdep +sdp
Dependencies added: base, deepseq, sdp
Files
- LICENSE +30/−0
- sdp-deepseq.cabal +45/−0
- src/Control/DeepSeq/SDP.hs +65/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Andrey Mulik (c) 2019++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Andrey Mulik nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ sdp-deepseq.cabal view
@@ -0,0 +1,45 @@+name: sdp-deepseq+version: 0.2+category: Data Structures++synopsis: DeepSeq SDP extension.+description: Provides NFData instances for SDP structures.++author: Andrey Mulik+maintainer: <work.a.mulik@gmail.com>+bug-reports: https://github.com/andreymulik/sdp-deepseq/issues++copyright: 2019 Andrey Mulik+license-file: LICENSE+license: BSD3++build-type: Simple+cabal-version: >=1.10++source-repository head+ type: git+ location: https://github.com/andreymulik/sdp-deepseq++--- _ _____ ______ ______ ___ ______ __ __ ---+--- | | |_ _|| ___ \| ___ \ / _ \ | ___ \\ \ / / ---+--- | | | | | |_/ /| |_/ // /_\ \| |_/ / \ V / ---+--- | | | | | ___ \| / | _ || / \ / ---+--- | |____ _| |_ | |_/ /| |\ \ | | | || |\ \ | | ---+--- \_____/ \___/ \____/ \_| \_|\_| |_/\_| \_| \_/ ---++Library+ default-language: Haskell2010+ hs-source-dirs: src+ + build-depends:+ base >= 4.12 && < 5,+ sdp >= 0.2 && < 0.3,+ deepseq >= 1.4 && < 1.5+ + ghc-options: -Wall -Wno-orphans+ + exposed-modules:+ Control.DeepSeq.SDP+++
+ src/Control/DeepSeq/SDP.hs view
@@ -0,0 +1,65 @@+{-# LANGUAGE Safe, MagicHash, FlexibleInstances #-}++{- |+ Module : Control.DeepSeq.SDP+ Copyright : (c) Andrey Mulik 2019+ License : BSD-style+ Maintainer : work.a.mulik@gmail.com+ Portability : portable+ + @Control.DeepSeq.SDP@ contains 'NFData' instances for @sdp@ types.+-}+module Control.DeepSeq.SDP+(+ -- * Exports.+ module Control.DeepSeq+)+where++import Prelude ()+import SDP.SafePrelude++import SDP.Templates.AnyChunks+import SDP.Templates.AnyBorder+import SDP.Prim.SArray+import SDP.Prim.SBytes++import Control.DeepSeq++default ()++--------------------------------------------------------------------------------++{- NFData instances. -}++instance (NFData e) => NFData (SArray# e) where rnf = o_foldr' deepseq ()+instance (NFData e) => NFData (SBytes# e) where rnf = rwhnf++instance (NFData i, NFData (rep e)) => NFData (AnyBorder rep i e)+ where+ rnf (AnyBorder l u rep) = l `deepseq` u `deepseq` rnf rep++instance (NFData (rep e)) => NFData (AnyChunks rep e)+ where+ rnf = foldr' deepseq () . toChunks++--------------------------------------------------------------------------------++{- NFData1 and NFData2 instances. -}++instance NFData1 SArray# where liftRnf rnf' = o_foldr' (seq . rnf') ()++instance (NFData i, NFData1 rep) => NFData1 (AnyBorder rep i)+ where+ liftRnf rnf' (AnyBorder l u rep) = l `deepseq` u `deepseq` liftRnf rnf' rep++instance (NFData1 rep) => NFData1 (AnyChunks rep)+ where+ liftRnf rnf' = foldr' (seq . liftRnf rnf') () . toChunks++instance (NFData1 rep) => NFData2 (AnyBorder rep)+ where+ liftRnf2 rnf' rnf'' (AnyBorder l u rep) = rnf' l `seq` rnf' u `seq` liftRnf rnf'' rep+++