danidiaz / dep-t

Dependency injection for records-of-functions.
http://hackage.haskell.org/package/dep-t
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

`Has` instances for tuples? #22

Closed danidiaz closed 1 year ago

danidiaz commented 2 years ago

They would be a simpler alternative to InductiveEnv for many cases.

Something like

instance Has r1_ m (r1_ m, y) where
  dep (r1,_) = r1

instance Has r2_ m (x, r2_ m) where
  dep (_,r2) = r2

instance Has r1_ m (r1_ m, y, z) where
  dep (r1,_,_) = r1

instance Has r2_ m (x, r2_ m, z) where
  dep (_,r2,_) = r2

instance Has r3_ m (x, y, r3_ m) where
  dep (_,_,r3) = r3

Also an instance for Solo, starting with GHC 9.2.

Would GHC complain about overlapping instances?

danidiaz commented 1 year ago

Added in 2f59f87eb3f01f1e9a8e877fd9dcd91a5f64c534. Instance for Solo still missing, though.