add tuple fields
This commit is contained in:
parent
9ddb7a726e
commit
e9c19b2955
1 changed files with 13 additions and 0 deletions
|
@ -10,3 +10,16 @@ import GHC.OverloadedLabels
|
||||||
|
|
||||||
instance HasField x r a => IsLabel x (r -> a) where
|
instance HasField x r a => IsLabel x (r -> a) where
|
||||||
fromLabel = getField @x
|
fromLabel = getField @x
|
||||||
|
|
||||||
|
|
||||||
|
instance HasField "first" (a, b) a where getField (x, _) = x
|
||||||
|
instance HasField "second" (a, b) b where getField (_, y) = y
|
||||||
|
|
||||||
|
instance HasField "first" (a, b, c) a where getField (x, _, _) = x
|
||||||
|
instance HasField "second" (a, b, c) b where getField (_, y, _) = y
|
||||||
|
instance HasField "third" (a, b, c) c where getField (_, _, z) = z
|
||||||
|
|
||||||
|
instance HasField "first" (a, b, c, d) a where getField (x, _, _, _) = x
|
||||||
|
instance HasField "second" (a, b, c, d) b where getField (_, y, _, _) = y
|
||||||
|
instance HasField "third" (a, b, c, d) c where getField (_, _, z, _) = z
|
||||||
|
instance HasField "fourth" (a, b, c, d) d where getField (_, _, _, w) = w
|
||||||
|
|
Loading…
Reference in a new issue