@@ -96,7 +96,7 @@ class GIsList
9696instance
9797 ( GIsList l l' as as'
9898 , GIsList r r' bs bs'
99− , Appending HList as bs cs as' bs' cs'
99+ , Appending as bs cs as' bs' cs'
100100 , cs ~ (as ++ bs)
101101 , cs' ~ (as' ++ bs')
102102 ) => GIsList (l :*: r) (l' :*: r') cs cs' where
@@ -118,24 +118,29 @@ instance GIsList U1 U1 '[] '[] where
118118
119119--------------------------------------------------------------------------------
120120-- | as ++ bs === cs
121−class Appending f (as :: [k]) bs cs (as' :: [k]) bs' cs' | as bs cs cs' -> as' bs', as' bs' cs cs' -> as bs, as bs -> cs, as' bs' -> cs' where
122− appending :: Iso (f as, f bs) (f as', f bs') (f cs) (f cs')
121+class Appending as bs cs as' bs' cs'
122+ | as bs cs cs' -> as' bs'
123+ , as' bs' cs cs' -> as bs
124+ , as bs -> cs
125+ , as' bs' -> cs'
126+ where
127+ appending :: Iso (HList as, HList bs) (HList as', HList bs') (HList cs) (HList cs')
123128
124129-- | [] ++ bs === bs
125−instance Appending HList '[] bs bs '[] bs' bs' where
126− appending = iso (\(_, b) -> b) (Nil,)
130+instance Appending '[] bs bs '[] bs' bs' where
131+ appending = iso snd (Nil,)
127132
128133-- | (a : as) ++ bs === (a : cs)
129134instance
130− Appending HList as bs cs as' bs' cs' -- as ++ bs == cs
131− => Appending HList (a ': as) bs (a ': cs) (a' ': as') bs' (a' ': cs') where
135+ Appending as bs cs as' bs' cs' -- as ++ bs == cs
136+ => Appending (a ': as) bs (a ': cs) (a' ': as') bs' (a' ': cs') where
132137 appending
133138 = pairing (fromIso consing) id -- ((a, as), bs)
134139 . assoc3 -- (a, (as, bs))
135140 . pairing id appending -- (a, cs)
136141 . consing -- (a : cs)
137142
138−singleton :: Iso a b (HList '[ a]) (HList '[ b])
143+singleton :: Iso a b (HList '[a]) (HList '[ b])
139144singleton = iso (:> Nil) (\(x :> _) -> x)
140145
141146consing :: Iso (a, HList as) (b, HList bs) (HList (a ': as)) (HList (b ': bs))
@@ -176,127 +181,127 @@ instance ListTuple () '[] where
176181 tupleToList _ = Nil
177182 listToTuple _ = ()
178183
179−instance ListTuple a '[ a] where
180− type ListToTuple '[ a] = a
184+instance ListTuple a '[a] where
185+ type ListToTuple '[a] = a
181186 tupleToList a
182187 = a :> Nil
183188 listToTuple (a :> Nil)
184189 = a
185190
186−instance ListTuple (a, b) '[ a, b] where
187− type ListToTuple '[ a, b] = (a, b)
191+instance ListTuple (a, b) '[a, b] where
192+ type ListToTuple '[a, b] = (a, b)
188193 tupleToList (a, b)
189194 = a :> b :> Nil
190195 listToTuple (a :> b :> Nil)
191196 = (a, b)
192197
193−instance ListTuple (a, b, c) '[ a, b, c] where
194− type ListToTuple '[ a, b, c] = (a, b, c)
198+instance ListTuple (a, b, c) '[a, b, c] where
199+ type ListToTuple '[a, b, c] = (a, b, c)
195200 tupleToList (a, b, c)
196201 = a :> b :> c :> Nil
197202 listToTuple (a :> b :> c :> Nil)
198203 = (a, b, c)
199204
200−instance ListTuple (a, b, c, d) '[ a, b, c, d] where
201− type ListToTuple '[ a, b, c, d] = (a, b, c, d)
205+instance ListTuple (a, b, c, d) '[a, b, c, d] where
206+ type ListToTuple '[a, b, c, d] = (a, b, c, d)
202207 tupleToList (a, b, c, d)
203208 = a :> b :> c :> d:> Nil
204209 listToTuple (a :> b :> c :> d :> Nil)
205210 = (a, b, c, d)
206211
207−instance ListTuple (a, b, c, d, e) '[ a, b, c, d, e] where
208− type ListToTuple '[ a, b, c, d, e] = (a, b, c, d, e)
212+instance ListTuple (a, b, c, d, e) '[a, b, c, d, e] where
213+ type ListToTuple '[a, b, c, d, e] = (a, b, c, d, e)
209214 tupleToList (a, b, c, d, e)
210215 = a :> b :> c :> d:> e :> Nil
211216 listToTuple (a :> b :> c :> d :> e :> Nil)
212217 = (a, b, c, d, e)
213218
214−instance ListTuple (a, b, c, d, e, f) '[ a, b, c, d, e, f] where
215− type ListToTuple '[ a, b, c, d, e, f] = (a, b, c, d, e, f)
219+instance ListTuple (a, b, c, d, e, f) '[a, b, c, d, e, f] where
220+ type ListToTuple '[a, b, c, d, e, f] = (a, b, c, d, e, f)
216221 tupleToList (a, b, c, d, e, f)
217222 = a :> b :> c :> d:> e :> f :> Nil
218223 listToTuple (a :> b :> c :> d :> e :> f :> Nil)
219224 = (a, b, c, d, e, f)
220225
221−instance ListTuple (a, b, c, d, e, f, g) '[ a, b, c, d, e, f, g] where
222− type ListToTuple '[ a, b, c, d, e, f, g] = (a, b, c, d, e, f, g)
226+instance ListTuple (a, b, c, d, e, f, g) '[a, b, c, d, e, f, g] where
227+ type ListToTuple '[a, b, c, d, e, f, g] = (a, b, c, d, e, f, g)
223228 tupleToList (a, b, c, d, e, f, g)
224229 = a :> b :> c :> d:> e :> f :> g :> Nil
225230 listToTuple (a :> b :> c :> d :> e :> f :> g :> Nil)
226231 = (a, b, c, d, e, f, g)
227232
228−instance ListTuple (a, b, c, d, e, f, g, h) '[ a, b, c, d, e, f, g, h] where
229− type ListToTuple '[ a, b, c, d, e, f, g, h] = (a, b, c, d, e, f, g, h)
233+instance ListTuple (a, b, c, d, e, f, g, h) '[a, b, c, d, e, f, g, h] where
234+ type ListToTuple '[a, b, c, d, e, f, g, h] = (a, b, c, d, e, f, g, h)
230235 tupleToList (a, b, c, d, e, f, g, h)
231236 = a :> b :> c :> d:> e :> f :> g :> h :> Nil
232237 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> Nil)
233238 = (a, b, c, d, e, f, g, h)
234239
235−instance ListTuple (a, b, c, d, e, f, g, h, j) '[ a, b, c, d, e, f, g, h, j] where
236− type ListToTuple '[ a, b, c, d, e, f, g, h, j] = (a, b, c, d, e, f, g, h, j)
240+instance ListTuple (a, b, c, d, e, f, g, h, j) '[a, b, c, d, e, f, g, h, j] where
241+ type ListToTuple '[a, b, c, d, e, f, g, h, j] = (a, b, c, d, e, f, g, h, j)
237242 tupleToList (a, b, c, d, e, f, g, h, j)
238243 = a :> b :> c :> d:> e :> f :> g :> h :> j :> Nil
239244 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> Nil)
240245 = (a, b, c, d, e, f, g, h, j)
241246
242−instance ListTuple (a, b, c, d, e, f, g, h, j, k) '[ a, b, c, d, e, f, g, h, j, k] where
243− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k] = (a, b, c, d, e, f, g, h, j, k)
247+instance ListTuple (a, b, c, d, e, f, g, h, j, k) '[a, b, c, d, e, f, g, h, j, k] where
248+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k] = (a, b, c, d, e, f, g, h, j, k)
244249 tupleToList (a, b, c, d, e, f, g, h, j, k)
245250 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> Nil
246251 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> Nil)
247252 = (a, b, c, d, e, f, g, h, j, k)
248253
249−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l) '[ a, b, c, d, e, f, g, h, j, k, l] where
250− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l] = (a, b, c, d, e, f, g, h, j, k, l)
254+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l) '[a, b, c, d, e, f, g, h, j, k, l] where
255+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l] = (a, b, c, d, e, f, g, h, j, k, l)
251256 tupleToList (a, b, c, d, e, f, g, h, j, k, l)
252257 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> Nil
253258 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> Nil)
254259 = (a, b, c, d, e, f, g, h, j, k, l)
255260
256−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m) '[ a, b, c, d, e, f, g, h, j, k, l, m] where
257− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m] = (a, b, c, d, e, f, g, h, j, k, l, m)
261+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m) '[a, b, c, d, e, f, g, h, j, k, l, m] where
262+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m] = (a, b, c, d, e, f, g, h, j, k, l, m)
258263 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m)
259264 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> Nil
260265 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> Nil)
261266 = (a, b, c, d, e, f, g, h, j, k, l, m)
262267
263−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n) '[ a, b, c, d, e, f, g, h, j, k, l, m, n] where
264− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m, n] = (a, b, c, d, e, f, g, h, j, k, l, m, n)
268+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n) '[a, b, c, d, e, f, g, h, j, k, l, m, n] where
269+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m, n] = (a, b, c, d, e, f, g, h, j, k, l, m, n)
265270 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n)
266271 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> n :> Nil
267272 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> n :> Nil)
268273 = (a, b, c, d, e, f, g, h, j, k, l, m, n)
269274
270−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o) '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o] where
271− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o)
275+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o) '[a, b, c, d, e, f, g, h, j, k, l, m, n, o] where
276+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m, n, o] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o)
272277 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o)
273278 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> Nil
274279 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> Nil)
275280 = (a, b, c, d, e, f, g, h, j, k, l, m, n, o)
276281
277−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p) '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p] where
278− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p)
282+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p) '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p] where
283+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p)
279284 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p)
280285 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> Nil
281286 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> Nil)
282287 = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p)
283288
284−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q) '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q] where
285− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q)
289+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q) '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q] where
290+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q)
286291 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q)
287292 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> q :> Nil
288293 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> q :> Nil)
289294 = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q)
290295
291−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r) '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r] where
292− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r)
296+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r) '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r] where
297+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r)
293298 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r)
294299 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> q :> r :> Nil
295300 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> q :> r :> Nil)
296301 = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r)
297302
298−instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s) '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s] where
299− type ListToTuple '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s)
303+instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s) '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s] where
304+ type ListToTuple '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s] = (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s)
300305 tupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s)
301306 = a :> b :> c :> d:> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> q :> r :> s :> Nil
302307 listToTuple (a :> b :> c :> d :> e :> f :> g :> h :> j :> k :> l :> m :> n :> o :> p :> q :> r :> s :> Nil)
@@ -304,21 +309,21 @@ instance ListTuple (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s) '[ a,
304309
305310type family TupleToList a where
306311 TupleToList () = '[]
307− TupleToList (a, b) = '[ a, b]
308− TupleToList (a, b, c) = '[ a, b, c]
309− TupleToList (a, b, c, d) = '[ a, b, c, d]
310− TupleToList (a, b, c, d, e) = '[ a, b, c, d, e]
311− TupleToList (a, b, c, d, e, f) = '[ a, b, c, d, e, f]
312− TupleToList (a, b, c, d, e, f, g) = '[ a, b, c, d, e, f, g]
313− TupleToList (a, b, c, d, e, f, g, h) = '[ a, b, c, d, e, f, g, h]
314− TupleToList (a, b, c, d, e, f, g, h, j) = '[ a, b, c, d, e, f, g, h, j]
315− TupleToList (a, b, c, d, e, f, g, h, j, k) = '[ a, b, c, d, e, f, g, h, j, k]
316− TupleToList (a, b, c, d, e, f, g, h, j, k, l) = '[ a, b, c, d, e, f, g, h, j, k, l]
317− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m) = '[ a, b, c, d, e, f, g, h, j, k, l, m]
318− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n) = '[ a, b, c, d, e, f, g, h, j, k, l, m, n]
319− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o) = '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o]
320− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p) = '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p]
321− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q) = '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q]
322− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r) = '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r]
323− TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s) = '[ a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s]
324− TupleToList a = '[ a]
312+ TupleToList (a, b) = '[a, b]
313+ TupleToList (a, b, c) = '[a, b, c]
314+ TupleToList (a, b, c, d) = '[a, b, c, d]
315+ TupleToList (a, b, c, d, e) = '[a, b, c, d, e]
316+ TupleToList (a, b, c, d, e, f) = '[a, b, c, d, e, f]
317+ TupleToList (a, b, c, d, e, f, g) = '[a, b, c, d, e, f, g]
318+ TupleToList (a, b, c, d, e, f, g, h) = '[a, b, c, d, e, f, g, h]
319+ TupleToList (a, b, c, d, e, f, g, h, j) = '[a, b, c, d, e, f, g, h, j]
320+ TupleToList (a, b, c, d, e, f, g, h, j, k) = '[a, b, c, d, e, f, g, h, j, k]
321+ TupleToList (a, b, c, d, e, f, g, h, j, k, l) = '[a, b, c, d, e, f, g, h, j, k, l]
322+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m) = '[a, b, c, d, e, f, g, h, j, k, l, m]
323+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n) = '[a, b, c, d, e, f, g, h, j, k, l, m, n]
324+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o) = '[a, b, c, d, e, f, g, h, j, k, l, m, n, o]
325+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p) = '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p]
326+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q) = '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q]
327+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r) = '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r]
328+ TupleToList (a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s) = '[a, b, c, d, e, f, g, h, j, k, l, m, n, o, p, q, r, s]
329+ TupleToList a = '[a]