1 {-# LANGUAGE DefaultSignatures #-}
2 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE ScopedTypeVariables #-}
4 {-# LANGUAGE TypeFamilies #-}
5 {-# LANGUAGE TypeOperators #-}
6 -- | Expression for 'Bool'.
7 module Language.Symantic.Expr.Bool where
9 import Prelude hiding ((&&), not, (||))
11 import Language.Symantic.Type
12 import Language.Symantic.Expr.Common
13 import Language.Symantic.Trans.Common
17 class Sym_Bool repr where
18 bool :: Bool -> repr Bool
19 not :: repr Bool -> repr Bool
20 (&&) :: repr Bool -> repr Bool -> repr Bool
21 (||) :: repr Bool -> repr Bool -> repr Bool
22 xor :: repr Bool -> repr Bool -> repr Bool
23 xor x y = (x || y) && not (x && y)
25 default bool :: Trans t repr => Bool -> t repr Bool
26 default not :: Trans t repr => t repr Bool -> t repr Bool
27 default (&&) :: Trans t repr => t repr Bool -> t repr Bool -> t repr Bool
28 default (||) :: Trans t repr => t repr Bool -> t repr Bool -> t repr Bool
29 bool = trans_lift . bool
31 (&&) = trans_map2 (&&)
32 (||) = trans_map2 (||)
39 data Expr_Bool (root:: *)
40 type instance Root_of_Expr (Expr_Bool root) = root
41 type instance Type_of_Expr (Expr_Bool root) = Type_Bool
42 type instance Sym_of_Expr (Expr_Bool root) repr = Sym_Bool repr
43 type instance Error_of_Expr ast (Expr_Bool root) = No_Error_Expr