diff options
Diffstat (limited to 'app/Tuple.hs')
-rw-r--r-- | app/Tuple.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Tuple.hs b/app/Tuple.hs new file mode 100644 index 0000000..8b43279 --- /dev/null +++ b/app/Tuple.hs @@ -0,0 +1,20 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module Tuple where + +import GHC.Records (HasField (..)) + +instance HasField "_1" (a, b) a where + getField (a, _) = a + +instance HasField "_2" (a, b) b where + getField (_, b) = b + +instance HasField "_1" (a, b, c) a where + getField (a, _, _) = a + +instance HasField "_2" (a, b, c) b where + getField (_, b, _) = b + +instance HasField "_3" (a, b, c) c where + getField (_, _, c) = c |