packages feed

exinst-deepseq (empty) → 0.1

raw patch · 6 files changed

+122/−0 lines, 6 filesdep +basedep +constraintsdep +deepseqsetup-changed

Dependencies added: base, constraints, deepseq, exinst

Files

+ CHANGELOG.md view
@@ -0,0 +1,3 @@+# Version 0.1++* Initial release.
+ LICENSE.txt view
@@ -0,0 +1,30 @@+Copyright (c) 2015, Renzo Carbonara++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 Renzo Carbonara 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.
+ README.md view
@@ -0,0 +1,2 @@+See the README file in the @exinst@ package for more general documentation:+https://hackage.haskell.org/package/exinst#readme
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ exinst-deepseq.cabal view
@@ -0,0 +1,27 @@+name:                exinst-deepseq+version:             0.1+author:              Renzo Carbonara+maintainer:          renzoλcarbonara.com.ar+copyright:           Renzo Carbonara 2015+license:             BSD3+license-file:        LICENSE.txt+extra-source-files:  README.md CHANGELOG.md+category:            Data+build-type:          Simple+cabal-version:       >=1.18+synopsis:            Derive instances for the `deepseq` library for your existential types.+homepage:            https://github.com/k0001/exinst+bug-reports:         https://github.com/k0001/exinst/issues++library+  hs-source-dirs: src/lib+  default-language: Haskell2010+  exposed-modules:+      Exinst.Instances.DeepSeq+  build-depends:+      base >=4.7 && <4.9+    , deepseq >=1.4 && <1.5+    , constraints >=0.4 && <0.5+    , exinst >=0.1 && <0.2+  ghcjs-options: -Wall -O3+  ghc-options: -Wall -O2
+ src/lib/Exinst/Instances/DeepSeq.hs view
@@ -0,0 +1,58 @@+{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE UndecidableInstances #-}++{-# OPTIONS_GHC -fno-warn-orphans #-}++-- | This module exports 'NFData' instances for 'Some1', 'Some2', 'Some3' and+-- 'Some4' from "Exinst.Singletons", provided situable 'Dict1', 'Dict2', 'Dict3'+-- and 'Dict4' instances are available.+--+-- See the README file in the @exinst@ package for more general documentation:+-- https://hackage.haskell.org/package/exinst#readme+module Exinst.Instances.DeepSeq () where++import           Control.DeepSeq (NFData(rnf))+import           Data.Constraint+import           Exinst.Singletons+import           Prelude++--------------------------------------------------------------------------------++instance forall (f1 :: k1 -> *)+  . ( Dict1 NFData f1+    ) => NFData (Some1 f1)+  where+    {-# INLINABLE rnf #-}+    rnf !some1x = withSome1Sing some1x $ \ !sa1 !(x :: f1 a1) ->+       case dict1 sa1 :: Dict (NFData (f1 a1)) of+          Dict -> rnf x `seq` ()++instance forall (f2 :: k2 -> k1 -> *)+  . ( Dict2 NFData f2+    ) => NFData (Some2 f2)+  where+    {-# INLINABLE rnf #-}+    rnf !some2x = withSome2Sing some2x $ \ !sa2 !sa1 !(x :: f2 a2 a1) ->+       case dict2 sa2 sa1 :: Dict (NFData (f2 a2 a1)) of+          Dict -> rnf x `seq` ()++instance forall (f3 :: k3 -> k2 -> k1 -> *)+  . ( Dict3 NFData f3+    ) => NFData (Some3 f3)+  where+    {-# INLINABLE rnf #-}+    rnf !some3x = withSome3Sing some3x $ \ !sa3 !sa2 !sa1 !(x :: f3 a3 a2 a1) ->+       case dict3 sa3 sa2 sa1 :: Dict (NFData (f3 a3 a2 a1)) of+          Dict -> rnf x `seq` ()++instance forall (f4 :: k4 -> k3 -> k2 -> k1 -> *)+  . ( Dict4 NFData f4+    ) => NFData (Some4 f4)+  where+    {-# INLINABLE rnf #-}+    rnf !some4x = withSome4Sing some4x $ \ !(sa4) !sa3 !sa2 !sa1 !(x :: f4 a4 a3 a2 a1) ->+       case dict4 sa4 sa3 sa2 sa1 :: Dict (NFData (f4 a4 a3 a2 a1)) of+          Dict -> rnf x `seq` ()