{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- | Symantic for 'Query'. module Hcompta.LCC.Sym.Query where import Data.Maybe (Maybe(..)) import Data.Typeable (Typeable) import qualified Prelude () import Hcompta.LCC.Compta (Query, Queryable) import Language.Symantic -- * Class 'Sym_Query' type instance Sym Query = Sym_Query class Sym_Query term where instance Sym_Query Eval where instance Sym_Query View where instance (Sym_Query r1, Sym_Query r2) => Sym_Query (Dup r1 r2) where instance (Sym_Query term, Sym_Lambda term) => Sym_Query (BetaT term) instance FixityOf Query instance NameTyOf Query where nameTyOf _c = ["LCC"] `Mod` "Query" instance ClassInstancesFor Query where proveConstraintFor _c _q = Nothing instance TypeInstancesFor Query instance Gram_Term_AtomsFor src ss g Query instance ( Source src , Typeable ss , SymInj ss Query ) => ModuleFor src ss Query where moduleFor = ["LCC"] `moduleWhere` [ ] tyQuery :: Source src => Type src vs db -> Type src vs a -> Type src vs (Query db a) tyQuery db a = tyConstLen @(K Query) @Query (lenVars db) `tyApp` db `tyApp` a -- * Class 'Sym_Queryable' type instance Sym Queryable = Sym_Queryable class Sym_Queryable term where instance Sym_Queryable Eval where instance Sym_Queryable View where instance (Sym_Queryable r1, Sym_Queryable r2) => Sym_Queryable (Dup r1 r2) where instance (Sym_Queryable term, Sym_Lambda term) => Sym_Queryable (BetaT term) instance FixityOf Queryable instance NameTyOf Queryable where nameTyOf _c = ["LCC"] `Mod` "Queryable" instance ClassInstancesFor Queryable where proveConstraintFor _c _q = Nothing instance TypeInstancesFor Queryable instance Gram_Term_AtomsFor src ss g Queryable instance ( Source src , Typeable ss , SymInj ss Queryable ) => ModuleFor src ss Queryable where moduleFor = ["LCC"] `moduleWhere` [ ] tyQueryable :: Source src => Type src vs db -> Type src vs a -> Type src vs (Queryable db a) tyQueryable db a = tyConstLen @(K Queryable) @Queryable (lenVars db) `tyApp` db `tyApp` a