0 | module Idris.Syntax.TTC
2 | import public Core.Binary
3 | import public Core.TTC
6 | import TTImp.TTImp.TTC
10 | import Data.SortedMap
12 | import Libraries.Data.ANameMap
13 | import Libraries.Data.NameMap
14 | import Libraries.Data.NatSet
20 | toBuf (MkIFaceInfo ic impps ps cs ms ds)
35 | pure (MkIFaceInfo ic impps ps cs ms ds)
39 | toBuf InfixL = tag 0
40 | toBuf InfixR = tag 1
42 | toBuf Prefix = tag 3
50 | _ => corrupt "Fixity"
54 | toBuf (MkImport loc reexport path nameAs)
65 | pure (MkImport loc reexport path nameAs)
68 | TTC BindingModifier where
69 | toBuf NotBinding = tag 0
70 | toBuf Typebind = tag 1
71 | toBuf Autobind = tag 2
74 | 0 => pure NotBinding
77 | _ => corrupt "binding"
80 | TTC FixityInfo where
84 | toBuf fx.bindingInfo
93 | pure $
MkFixityInfo fc vis binding fix prec
97 | TTC SyntaxInfo where
99 | = do toBuf (ANameMap.toList (fixities syn))
100 | toBuf (filter (\n => elemBy (==) (fst n) (saveMod syn))
101 | (SortedMap.toList $
modDocstrings syn))
102 | toBuf (filter (\n => elemBy (==) (fst n) (saveMod syn))
103 | (SortedMap.toList $
modDocexports syn))
104 | toBuf (filter (\n => fst n `elem` saveIFaces syn)
105 | (ANameMap.toList (ifaces syn)))
106 | toBuf (filter (\n => isJust (lookup (fst n) (saveDocstrings syn)))
107 | (ANameMap.toList (defDocstrings syn)))
108 | toBuf (bracketholes syn)
109 | toBuf (startExpr syn)
110 | toBuf (holeNames syn)
113 | = do fix <- fromBuf
115 | modexpts <- fromBuf
117 | defdstrs <- fromBuf
121 | pure $
MkSyntax (fromList fix)
122 | [] (fromList moddstr) (fromList modexpts)
124 | empty (fromList defdstrs)