{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Hcompta.Lib.Strict where

import           Control.DeepSeq (NFData(..))
import           Data.Data
import qualified Data.Strict.Maybe as Strict

deriving instance Data x => Data (Strict.Maybe x)
instance Monoid x => Monoid (Strict.Maybe x) where
	mempty = Strict.Nothing
	mappend (Strict.Just x) (Strict.Just y) = Strict.Just (x `mappend` y)
	mappend x Strict.Nothing = x
	mappend Strict.Nothing y = y
instance NFData x => NFData (Strict.Maybe x) where
	rnf Strict.Nothing = ()
	rnf (Strict.Just x) = rnf x