1 {-# LANGUAGE UndecidableInstances #-}
2 {-# OPTIONS_GHC -fno-warn-orphans #-}
3 -- | Symantic for 'Zeroable'.
4 module Hcompta.LCC.Sym.Zeroable where
6 import Language.Symantic
7 import Language.Symantic.Lib (a0)
9 import Hcompta.Quantity as H hiding (zero)
10 import qualified Hcompta.Quantity as H
12 -- * Class 'Sym_Zeroable'
13 type instance Sym Zeroable = Sym_Zeroable
14 class Sym_Zeroable term where
15 zero :: Zeroable a => term a
16 default zero :: Sym_Zeroable (UnT term) => Trans term => Zeroable a => term a
19 instance Sym_Zeroable Eval where
21 instance Sym_Zeroable View where
23 instance (Sym_Zeroable r1, Sym_Zeroable r2) => Sym_Zeroable (Dup r1 r2) where
24 zero = dup0 @Sym_Zeroable zero
25 instance (Sym_Zeroable term, Sym_Lambda term) => Sym_Zeroable (BetaT term)
27 instance NameTyOf Zeroable where
28 nameTyOf _c = ["LCC"] `Mod` "Zeroable"
29 instance FixityOf Zeroable
30 instance ClassInstancesFor Zeroable
31 instance TypeInstancesFor Zeroable
32 instance Gram_Term_AtomsFor src ss g Zeroable
33 instance (Source src, SymInj ss Zeroable) => ModuleFor src ss Zeroable where
34 moduleFor = ["LCC"] `moduleWhere`
35 [ "zero" := teZeroable_zero
38 tyZeroable :: Source src => Type src vs a -> Type src vs (Zeroable a)
39 tyZeroable a = tyConstLen @(K Zeroable) @Zeroable (lenVars a) `tyApp` a
41 teZeroable_zero :: TermDef Zeroable '[Proxy a] (Zeroable a #> a)
42 teZeroable_zero = Term (tyZeroable a0) a0 (teSym @Zeroable zero)