]> Git — Sourcephile - comptalang.git/blob - cli/Hcompta/Expr/Set.hs
Gather into Writeable instances.
[comptalang.git] / cli / Hcompta / Expr / Set.hs
1 {-# LANGUAGE NoImplicitPrelude #-}
2 {-# OPTIONS_GHC -fno-warn-tabs #-}
3
4 module Hcompta.Expr.Set where
5
6 import Hcompta.Expr.Dup
7
8 -- * Class 'Expr_Set'
9
10 class Expr_Set repr where
11 complement :: repr a -> repr a
12 intersection :: repr a -> repr a -> repr a
13 union :: repr a -> repr a -> repr a
14
15 instance -- Expr_Set Dup
16 ( Expr_Set r1
17 , Expr_Set r2
18 ) => Expr_Set (Dup r1 r2) where
19 complement (x1 `Dup` x2) = complement x1 `Dup` complement x2
20 intersection (x1 `Dup` x2) (y1 `Dup` y2) = intersection x1 y1 `Dup` intersection x2 y2
21 union (x1 `Dup` x2) (y1 `Dup` y2) = union x1 y1 `Dup` union x2 y2