@@ -5,12 +5,11 @@ import Data.Either
55import Data.Fin.Set
66import Data.SortedMap
77import Data.Vect
8+ import Data.Vect.Quantifiers
89import Decidable.Equality
9- import Derive.Prelude
10+ import Deriving.Show
1011import Language.Reflection
1112import Language.Reflection.Expr
12- import Language.Reflection.TTImp
13- import Language.Reflection.TT
1413import Language.Reflection.Syntax
1514
1615%language ElabReflection
@@ -38,9 +37,24 @@ record UnificationTask where
3837
3938%name UnificationTask task
4039
41- %runElab derive " Count" [Show ]
42- %runElab derive " PiInfo" [Show ]
43- %runElab derive " Syntax.Arg" [Show ]
40+ sCount : Show Count
41+ sCount = % runElab derive
42+
43+ Show Count where
44+ show = show @{sCount}
45+
46+ sPiInfo : Show a => Show (PiInfo a)
47+ sPiInfo = % runElab derive
48+
49+ Show a => Show (PiInfo a) where
50+ show = show @{sPiInfo}
51+
52+ sArg : Show Arg
53+ sArg = % runElab derive
54+
55+ Show Arg where
56+ show = show @{sArg}
57+
4458
4559export
4660Show UnificationTask where
@@ -74,7 +88,17 @@ record FVData where
7488
7589%name FVData fv, fvData
7690
77- %runElab derive " FVData" [Show , Eq ]
91+ sFVData : Show FVData
92+ sFVData = % runElab derive
93+
94+ export
95+ Show FVData where
96+ show = show @{sFVData}
97+
98+ export
99+ Eq FVData where
100+ (MkFVData name holeName rig piInfo type value) == (MkFVData name' holeName' rig' piInfo' type' value') =
101+ name == name' && holeName == holeName' && rig == rig' && piInfo == piInfo' && type == type' && value == value'
78102
79103export
80104Interpolation FVData where
@@ -137,7 +161,18 @@ record DependencyGraph where
137161
138162%name DependencyGraph dg, depGraph
139163
140- %runElab derive " DependencyGraph" [Show ]
164+ export
165+ Show DependencyGraph where
166+ showPrec p t =
167+ showCon p " MkDG" $
168+ joinBy " " $
169+ [ showArg t. freeVars
170+ , showArg t. fvData
171+ , showArg t. fvDeps
172+ , showArg t. empties
173+ , showArg t. nameToId
174+ , showArg t. holeToId
175+ ]
141176
142177export
143178Eq DependencyGraph where
@@ -164,7 +199,18 @@ record UnificationResult where
164199 ||| (specialised constructor arguments)
165200 order : List $ Fin uniDg.freeVars
166201
167- %runElab derive " UnificationResult" [Show ]
202+ export
203+ Show UnificationResult where
204+ showPrec p t =
205+ showCon p " MkUR" $
206+ joinBy " " $
207+ [ showArg t. task
208+ , showArg t. uniDg
209+ , showArg t. lhsResult
210+ , showArg t. rhsResult
211+ , showArg t. fullResult
212+ , showArg t. order
213+ ]
168214
169215public export
170216data UnificationError : Type where
@@ -174,15 +220,34 @@ data UnificationError : Type where
174220 ExtractionError : TTImp -> UnificationError
175221 NoUnificationError : UnificationError
176222
177- %runElab derive " UnificationError" [Show , Eq ]
223+ sUE : Show UnificationError
224+ sUE = % runElab derive
225+
226+ export
227+ Show UnificationError where
228+ show = show @{sUE}
229+
230+ export
231+ Eq UnificationError where
232+ CatastrophicError == CatastrophicError = True
233+ InternalError s == InternalError s' = s == s'
234+ TargetTypeError t == TargetTypeError t' = t == t'
235+ ExtractionError t == ExtractionError t' = t == t'
236+ NoUnificationError == NoUnificationError = True
237+ _ == _ = False
178238
179239public export
180240data UnificationVerdict : Type where
181241 Success : UnificationResult -> UnificationVerdict
182242 Undecided : UnificationVerdict
183243 Fail : UnificationError -> UnificationVerdict
184244
185- %runElab derive " UnificationVerdict" [Show ]
245+ sUV : Show UnificationVerdict
246+ sUV = % runElab derive
247+
248+ export
249+ Show UnificationVerdict where
250+ show = show @{sUV}
186251
187252export % inline
188253isSuccess : UnificationVerdict -> Bool
0 commit comments