]> Git — Sourcephile - comptalang.git/blob - lcc/Hcompta/LCC/Source.hs
Remove cli/
[comptalang.git] / lcc / Hcompta / LCC / Source.hs
1 module Hcompta.LCC.Source where
2
3 import Data.Eq (Eq)
4 import Text.Show (Show)
5
6 import Language.Symantic hiding (Source(..))
7 import qualified Language.Symantic as Sym
8
9 import Hcompta.LCC.Compta (Compta)
10
11 -- * Type 'Source'
12 -- | A 'Source' usable when using 'readCompta'.
13 data Source inp ss
14 = Source_Less
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))
20 | Source_Term
21 deriving (Eq, Show)
22
23 type instance Source_Input (Source inp ss) = inp
24
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