import Control.Arrow ((***))
import Control.Monad (join)
-import Data.Maybe (fromJust)
+import Data.Bool
+import Data.Either (Either(..))
+import Data.Functor (Functor(..), (<$>))
+import Data.Maybe (Maybe(..), fromJust, fromMaybe)
import qualified Data.List
import Data.Map.Strict (Map)
+import Prelude (($), (.), uncurry)
import Hcompta.Date (Date)
import qualified Hcompta.Date as Date
-- for the given 'Filter_Bool' to filter.
bool_date :: Dated t => Filter_Bool t -> Simplified Reduce_Date
bool_date tst =
- simplify (maybe Any id $ go tst) (Nothing::Maybe Date)
+ simplify (fromMaybe Any $ go tst)
where
go :: Dated t
=> Filter_Bool t
Interval.Sieve.intersection s $
Interval.Sieve.singleton $
case to of
- Filter_Ord_Lt o -> fromJust $ Interval.interval (Interval.low bounds) (Interval.Limit Interval.Out o)
- Filter_Ord_Le o -> fromJust $ Interval.interval (Interval.low bounds) (Interval.Limit Interval.In o)
- Filter_Ord_Eq o -> Interval.point o
- Filter_Ord_Ge o -> fromJust $ Interval.interval (Interval.Limit Interval.In o) (Interval.high bounds)
- Filter_Ord_Gt o -> fromJust $ Interval.interval (Interval.Limit Interval.Out o) (Interval.high bounds)
+ Filter_Ord Lt o -> fromJust $ Interval.interval (Interval.low bounds) (Interval.Limit Interval.Out o)
+ Filter_Ord Le o -> fromJust $ Interval.interval (Interval.low bounds) (Interval.Limit Interval.In o)
+ Filter_Ord Eq o -> Interval.point o
+ Filter_Ord Ge o -> fromJust $ Interval.interval (Interval.Limit Interval.In o) (Interval.high bounds)
+ Filter_Ord Gt o -> fromJust $ Interval.interval (Interval.Limit Interval.Out o) (Interval.high bounds)
Filter_Ord_Any -> bounds
Filter_Date_Year (Filter_Interval_In i) ->
Interval.Sieve.intersection s $