File tree Expand file tree Collapse file tree 5 files changed +52
-2
lines changed
experiments/idris/src/Fathom Expand file tree Collapse file tree 5 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,16 @@ record Format where
9696 format : FormatOf Rep
9797
9898
99+ namespace Format
100+
101+ decode : (f : Format) -> Decode (Rep f, Colist a) (Colist a)
102+ decode f = FormatOf.decode f.format
103+
104+
105+ encode : (f : Format) -> Encode (Rep f) (Colist a)
106+ encode f = FormatOf.encode f.format
107+
108+
99109------------------------------------
100110-- FORMAT DESCRIPTION CONVERSIONS --
101111------------------------------------
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ namespace FormatOf
6262
6363
6464 export
65- decode : {0 A : Type } -> (f : FormatOf A) -> Decode (A, ByteStream) ( ByteStream)
65+ decode : {0 A : Type } -> (f : FormatOf A) -> Decode (A, ByteStream) ByteStream
6666 decode End [] = Just (() , [])
6767 decode End (_ :: _ ) = Nothing
6868 decode Fail _ = Nothing
@@ -85,7 +85,7 @@ namespace FormatOf
8585
8686
8787 export
88- encode : {0 A : Type} -> (f : FormatOf A) -> Encode A ( ByteStream)
88+ encode : {0 A : Type} -> (f : FormatOf A) -> Encode A ByteStream
8989 encode End () = Just []
9090 encode (Pure x) (MkSing _) = Just []
9191 encode (Skip f def) () = encode f def
@@ -112,6 +112,16 @@ record Format where
112112 format : FormatOf Rep
113113
114114
115+ namespace Format
116+
117+ decode : (f : Format) -> Decode (Rep f, ByteStream) ByteStream
118+ decode f = FormatOf.decode f.format
119+
120+
121+ encode : (f : Format) -> Encode (Rep f) ByteStream
122+ encode f = FormatOf.encode f.format
123+
124+
115125------------------------------------
116126-- FORMAT DESCRIPTION CONVERSIONS --
117127------------------------------------
Original file line number Diff line number Diff line change @@ -124,6 +124,16 @@ data FormatOf : (A : Type) -> Type where
124124 MkFormatOf : (f : Format) -> FormatOf (Rep f)
125125
126126
127+ namespace FormatOf
128+
129+ decode : {0 A : Type} -> (f : FormatOf A) -> Decode (A, ByteStream) ByteStream
130+ decode (MkFormatOf f) = Format.decode f
131+
132+
133+ encode : {0 A : Type} -> (f : FormatOf A) -> Encode A ByteStream
134+ encode (MkFormatOf f) = Format.encode f
135+
136+
127137------------------------------------
128138-- FORMAT DESCRIPTION CONVERSIONS --
129139------------------------------------
Original file line number Diff line number Diff line change @@ -159,6 +159,16 @@ data FormatOf : (Rep : Type) -> Type where
159159 MkFormatOf : (f : Format) -> FormatOf (Rep f)
160160
161161
162+ namespace FormatOf
163+
164+ decode : {0 A : Type} -> (f : FormatOf A) -> Decode (A, ByteStream) ByteStream
165+ decode (MkFormatOf f) = Format.decode f
166+
167+
168+ encode : {0 A : Type} -> (f : FormatOf A) -> Encode A ByteStream
169+ encode (MkFormatOf f) = Format.encode f
170+
171+
162172------------------------------------
163173-- FORMAT DESCRIPTION CONVERSIONS --
164174------------------------------------
Original file line number Diff line number Diff line change @@ -182,6 +182,16 @@ data FormatOf : (A : Type) -> Type where
182182 MkFormatOf : (f : Format) -> FormatOf f.Rep
183183
184184
185+ namespace FormatOf
186+
187+ decode : {0 A : Type} -> (f : FormatOf A) -> Decode (A, ByteStream) ByteStream
188+ decode (MkFormatOf f) = Format.decode f
189+
190+
191+ encode : {0 A : Type} -> (f : FormatOf A) -> Encode A ByteStream
192+ encode (MkFormatOf f) = Format.encode f
193+
194+
185195------------------------------------
186196-- FORMAT DESCRIPTION CONVERSIONS --
187197------------------------------------
You can’t perform that action at this time.
0 commit comments