{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}

module Hcompta.Expr.Set where

import Hcompta.Expr.Dup

-- * Class 'Expr_Set'

class Expr_Set repr where
	complement   :: repr a -> repr a
	intersection :: repr a -> repr a -> repr a
	union        :: repr a -> repr a -> repr a

instance -- Expr_Set Dup
 ( Expr_Set r1
 , Expr_Set r2
 ) => Expr_Set (Dup r1 r2) where
	complement (x1 `Dup` x2) = complement x1 `Dup` complement x2
	intersection (x1 `Dup` x2) (y1 `Dup` y2) = intersection x1 y1 `Dup` intersection x2 y2
	union  (x1 `Dup` x2) (y1 `Dup` y2) = union  x1 y1 `Dup` union  x2 y2