Replace boileplate ToSample instances for tuples with empty ones
We just use default Generics implementation for tuples now.
This commit is contained in:
parent
80f235b986
commit
75999b8211
1 changed files with 6 additions and 148 deletions
|
@ -964,152 +964,10 @@ instance HasDocs sublayout => HasDocs (Vault :> sublayout) where
|
|||
|
||||
-- polymorphic 'ToSample' instances
|
||||
|
||||
instance ( ToSample a a
|
||||
, ToSample b b
|
||||
) => ToSample (a, b) (a, b) where
|
||||
toSample _ = (,)
|
||||
<$> toSample (Proxy :: Proxy a)
|
||||
<*> toSample (Proxy :: Proxy b)
|
||||
toSamples _ = render
|
||||
<$> toSamples (Proxy :: Proxy a)
|
||||
<*> toSamples (Proxy :: Proxy b)
|
||||
where render (ta, va) (tb, vb)
|
||||
= ("(" <> ta <>
|
||||
", " <> tb <>
|
||||
")"
|
||||
, (va, vb))
|
||||
instance (ToSample a a, ToSample b b) => ToSample (a, b) (a, b)
|
||||
instance (ToSample a a, ToSample b b, ToSample c c) => ToSample (a, b, c) (a, b, c)
|
||||
instance (ToSample a a, ToSample b b, ToSample c c, ToSample d d) => ToSample (a, b, c, d) (a, b, c, d)
|
||||
instance (ToSample a a, ToSample b b, ToSample c c, ToSample d d, ToSample e e) => ToSample (a, b, c, d, e) (a, b, c, d, e)
|
||||
instance (ToSample a a, ToSample b b, ToSample c c, ToSample d d, ToSample e e, ToSample f f) => ToSample (a, b, c, d, e, f) (a, b, c, d, e, f)
|
||||
instance (ToSample a a, ToSample b b, ToSample c c, ToSample d d, ToSample e e, ToSample f f, ToSample g g) => ToSample (a, b, c, d, e, f, g) (a, b, c, d, e, f, g)
|
||||
|
||||
instance ( ToSample a a
|
||||
, ToSample b b
|
||||
, ToSample c c
|
||||
) => ToSample (a, b, c) (a, b, c) where
|
||||
toSample _ = (,,)
|
||||
<$> toSample (Proxy :: Proxy a)
|
||||
<*> toSample (Proxy :: Proxy b)
|
||||
<*> toSample (Proxy :: Proxy c)
|
||||
toSamples _ = render
|
||||
<$> toSamples (Proxy :: Proxy a)
|
||||
<*> toSamples (Proxy :: Proxy b)
|
||||
<*> toSamples (Proxy :: Proxy c)
|
||||
where render (ta, va) (tb, vb) (tc, vc)
|
||||
= ("(" <> ta <>
|
||||
", " <> tb <>
|
||||
", " <> tc <>
|
||||
")"
|
||||
, (va, vb, vc))
|
||||
|
||||
instance ( ToSample a a
|
||||
, ToSample b b
|
||||
, ToSample c c
|
||||
, ToSample d d
|
||||
) => ToSample (a, b, c, d) (a, b, c, d) where
|
||||
toSample _ = (,,,)
|
||||
<$> toSample (Proxy :: Proxy a)
|
||||
<*> toSample (Proxy :: Proxy b)
|
||||
<*> toSample (Proxy :: Proxy c)
|
||||
<*> toSample (Proxy :: Proxy d)
|
||||
toSamples _ = render
|
||||
<$> toSamples (Proxy :: Proxy a)
|
||||
<*> toSamples (Proxy :: Proxy b)
|
||||
<*> toSamples (Proxy :: Proxy c)
|
||||
<*> toSamples (Proxy :: Proxy d)
|
||||
where render (ta, va) (tb, vb) (tc, vc) (td, vd)
|
||||
= ("(" <> ta <>
|
||||
", " <> tb <>
|
||||
", " <> tc <>
|
||||
", " <> td <>
|
||||
")"
|
||||
, (va, vb, vc, vd))
|
||||
|
||||
instance ( ToSample a a
|
||||
, ToSample b b
|
||||
, ToSample c c
|
||||
, ToSample d d
|
||||
, ToSample e e
|
||||
) => ToSample (a, b, c, d, e) (a, b, c, d, e) where
|
||||
toSample _ = (,,,,)
|
||||
<$> toSample (Proxy :: Proxy a)
|
||||
<*> toSample (Proxy :: Proxy b)
|
||||
<*> toSample (Proxy :: Proxy c)
|
||||
<*> toSample (Proxy :: Proxy d)
|
||||
<*> toSample (Proxy :: Proxy e)
|
||||
toSamples _ = render
|
||||
<$> toSamples (Proxy :: Proxy a)
|
||||
<*> toSamples (Proxy :: Proxy b)
|
||||
<*> toSamples (Proxy :: Proxy c)
|
||||
<*> toSamples (Proxy :: Proxy d)
|
||||
<*> toSamples (Proxy :: Proxy e)
|
||||
where render (ta, va) (tb, vb) (tc, vc) (td, vd) (te, ve)
|
||||
= ("(" <> ta <>
|
||||
", " <> tb <>
|
||||
", " <> tc <>
|
||||
", " <> td <>
|
||||
", " <> te <>
|
||||
")"
|
||||
, (va, vb, vc, vd, ve))
|
||||
|
||||
instance ( ToSample a a
|
||||
, ToSample b b
|
||||
, ToSample c c
|
||||
, ToSample d d
|
||||
, ToSample e e
|
||||
, ToSample f f
|
||||
) => ToSample (a, b, c, d, e, f) (a, b, c, d, e, f) where
|
||||
toSample _ = (,,,,,)
|
||||
<$> toSample (Proxy :: Proxy a)
|
||||
<*> toSample (Proxy :: Proxy b)
|
||||
<*> toSample (Proxy :: Proxy c)
|
||||
<*> toSample (Proxy :: Proxy d)
|
||||
<*> toSample (Proxy :: Proxy e)
|
||||
<*> toSample (Proxy :: Proxy f)
|
||||
toSamples _ = render
|
||||
<$> toSamples (Proxy :: Proxy a)
|
||||
<*> toSamples (Proxy :: Proxy b)
|
||||
<*> toSamples (Proxy :: Proxy c)
|
||||
<*> toSamples (Proxy :: Proxy d)
|
||||
<*> toSamples (Proxy :: Proxy e)
|
||||
<*> toSamples (Proxy :: Proxy f)
|
||||
where render (ta, va) (tb, vb) (tc, vc) (td, vd) (te, ve) (tf, vf)
|
||||
= ("(" <> ta <>
|
||||
", " <> tb <>
|
||||
", " <> tc <>
|
||||
", " <> td <>
|
||||
", " <> te <>
|
||||
", " <> tf <>
|
||||
")"
|
||||
, (va, vb, vc, vd, ve, vf))
|
||||
|
||||
instance ( ToSample a a
|
||||
, ToSample b b
|
||||
, ToSample c c
|
||||
, ToSample d d
|
||||
, ToSample e e
|
||||
, ToSample f f
|
||||
, ToSample g g
|
||||
) => ToSample (a, b, c, d, e, f, g) (a, b, c, d, e, f, g) where
|
||||
toSample _ = (,,,,,,)
|
||||
<$> toSample (Proxy :: Proxy a)
|
||||
<*> toSample (Proxy :: Proxy b)
|
||||
<*> toSample (Proxy :: Proxy c)
|
||||
<*> toSample (Proxy :: Proxy d)
|
||||
<*> toSample (Proxy :: Proxy e)
|
||||
<*> toSample (Proxy :: Proxy f)
|
||||
<*> toSample (Proxy :: Proxy g)
|
||||
toSamples _ = render
|
||||
<$> toSamples (Proxy :: Proxy a)
|
||||
<*> toSamples (Proxy :: Proxy b)
|
||||
<*> toSamples (Proxy :: Proxy c)
|
||||
<*> toSamples (Proxy :: Proxy d)
|
||||
<*> toSamples (Proxy :: Proxy e)
|
||||
<*> toSamples (Proxy :: Proxy f)
|
||||
<*> toSamples (Proxy :: Proxy g)
|
||||
where render (ta, va) (tb, vb) (tc, vc) (td, vd) (te, ve) (tf, vf) (tg, vg)
|
||||
= ("(" <> ta <>
|
||||
", " <> tb <>
|
||||
", " <> tc <>
|
||||
", " <> td <>
|
||||
", " <> te <>
|
||||
", " <> tf <>
|
||||
", " <> tg <>
|
||||
")"
|
||||
, (va, vb, vc, vd, ve, vf, vg))
|
||||
|
|
Loading…
Reference in a new issue