1 module Hcompta.LCC.Source where
4 import Text.Show (Show)
6 import Language.Symantic hiding (Source(..))
7 import qualified Language.Symantic as Sym
9 import Hcompta.LCC.Compta (Compta)
12 -- | A 'Source' usable when using 'readCompta'.
15 | Source_Input (Span inp)
16 | Source_AST_Term (AST_Term (Source inp ss) (Proxy (Compta (Source inp ss) ss) ': ss))
17 | Source_AST_Type (AST_Type (Source inp ss))
18 | Source_Kind (KindK (Source inp ss))
19 | Source_Type (TypeVT (Source inp ss))
23 type instance Source_Input (Source inp ss) = inp
25 instance Sym.Source (Source inp ss) where
26 noSource = Source_Less
27 instance SourceInj (Span inp) (Source inp ss) where
28 sourceInj = Source_Input
29 instance SourceInj (AST_Term (Source inp ss) (Proxy (Compta (Source inp ss) ss) ': ss)) (Source inp ss) where
30 sourceInj = Source_AST_Term
31 instance SourceInj (AST_Type (Source inp ss)) (Source inp ss) where
32 sourceInj = Source_AST_Type
33 instance SourceInj (KindK (Source inp ss)) (Source inp ss) where
34 sourceInj = Source_Kind
35 instance SourceInj (TypeVT (Source inp ss)) (Source inp ss) where
36 sourceInj = Source_Type