{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# OPTIONS_GHC -fno-warn-tabs #-} module Expr.Bool.Test where import Data.Bool (Bool(..)) import Data.Function (($)) import Hcompta.Expr.Lit import Hcompta.Expr.Bool import Hcompta.Expr.Trans import Hcompta.Trans.Bool.Const import Hcompta.Repr e1 = lit True `and` lit False e2 = (lit True `and` lit False) `or` (lit True `and` lit True) e3 = (lit True `or` lit False) `and` (lit True `or` lit True) e4 = lit True `and` neg (lit False) e5 = lit True `and` neg x e6 = x `xor` y e7 = (x `xor` y) `xor` z e8 = x `xor` (y `xor` lit True) -- * Class 'Expr_Bool_Vars' -- | A few boolean variables. class Expr_Bool_Vars repr where x :: repr Bool y :: repr Bool z :: repr Bool instance -- Trans_Boo_Const ( Expr_Bool_Vars repr , Expr_Lit repr ) => Expr_Bool_Vars (Trans_Bool_Const repr) where x = trans_lift x y = trans_lift y z = trans_lift z instance Expr_Bool_Vars Repr_Text_Write where x = Repr_Text_Write $ \_p _v -> "x" y = Repr_Text_Write $ \_p _v -> "y" z = Repr_Text_Write $ \_p _v -> "z"