Fix Haddock markup.
[comptalang.git] / lib / Hcompta / Lib / Strict.hs
index 4dccb5047691dbc96004fecf4f0058ced81ad1e8..c05b7dfe81f0e1b53fcc9533bba0deaf24a9ea9d 100644 (file)
@@ -1,17 +1,20 @@
 {-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE StandaloneDeriving #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 module Hcompta.Lib.Strict where
 
-import           Control.DeepSeq (NFData(..))
-import           Data.Data
-import           Data.Eq (Eq)
-import           Data.Monoid (Monoid(..))
-import           Text.Show (Show)
-import           Prelude (seq)
+import Control.DeepSeq (NFData(..))
+import Data.Data
+import Data.Eq (Eq)
+import Data.Function ((.))
+import Data.Monoid (Monoid(..))
+import Data.NonNull (NonNull, toNullable)
+import Prelude (seq)
+import Text.Show (Show)
 
--- * Type 'Clusive'
+instance NFData s => NFData (NonNull s) where
+       rnf = rnf . toNullable
 
+-- * Type 'Clusive'
 -- A data type to calculate an 'inclusive' value
 -- (through some propagation mecanism,
 -- eg. incorporating the values of the children of a tree node),
@@ -22,13 +25,9 @@ data Clusive a
  { exclusive :: !a
  , inclusive :: !a
  } deriving (Data, Eq, Show, Typeable)
-instance -- Monoid
- Monoid a
- => Monoid (Clusive a) where
+instance Monoid a => Monoid (Clusive a) where
        mempty = Clusive mempty mempty
        mappend (Clusive e0 i0) (Clusive e1 i1) =
                Clusive (e0`mappend`e1) (i0`mappend`i1)
-instance -- NFData
- NFData a =>
- NFData (Clusive a) where
+instance NFData a => NFData (Clusive a) where
        rnf (Clusive e i)  = rnf e `seq` rnf i