1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE StandaloneDeriving #-}
3 {-# OPTIONS_GHC -fno-warn-deprecations #-} -- FIXME: to be removed when dropping GHC-7.6 support
4 {-# OPTIONS_GHC -fno-warn-orphans #-}
5 module Hcompta.Lib.Strict where
7 import Control.DeepSeq (NFData(..))
9 import Data.Monoid (Monoid(..))
10 import qualified Data.Strict.Maybe as Strict
12 deriving instance Data x => Data (Strict.Maybe x)
13 deriving instance Typeable1 Strict.Maybe
14 instance Monoid x => Monoid (Strict.Maybe x) where
15 mempty = Strict.Nothing
16 mappend (Strict.Just x) (Strict.Just y) = Strict.Just (x `mappend` y)
17 mappend x Strict.Nothing = x
18 mappend Strict.Nothing y = y
19 instance NFData x => NFData (Strict.Maybe x) where
20 rnf Strict.Nothing = ()
21 rnf (Strict.Just x) = rnf x