]> Git — Sourcephile - comptalang.git/blob - lib/Hcompta/Lib/Strict.hs
Modification : filtre dès la lecture pour moins de consommation mémoire.
[comptalang.git] / lib / Hcompta / Lib / Strict.hs
1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE StandaloneDeriving #-}
3 {-# OPTIONS_GHC -fno-warn-orphans #-}
4 module Hcompta.Lib.Strict where
5
6 import Control.DeepSeq (NFData(..))
7 import Data.Data
8 import qualified Data.Strict.Maybe as Strict
9
10 deriving instance Data x => Data (Strict.Maybe x)
11 instance Monoid x => Monoid (Strict.Maybe x) where
12 mempty = Strict.Nothing
13 mappend (Strict.Just x) (Strict.Just y) = Strict.Just (x `mappend` y)
14 mappend x Strict.Nothing = x
15 mappend Strict.Nothing y = y
16 instance NFData x => NFData (Strict.Maybe x) where
17 rnf Strict.Nothing = ()
18 rnf (Strict.Just x) = rnf x