-- SPDX-FileCopyrightText: 2020 Tocqueville Group
--
-- SPDX-License-Identifier: LicenseRef-MIT-TQ

{-# OPTIONS_GHC -Wno-orphans #-}

module Util.TypeTuple.Instances () where

import Data.Vinyl.Core (Rec(..))

import Util.TypeTuple.Class
import Util.TypeTuple.TH

concatMapM deriveRecFromTuple (0 : [2..25])
-- ↑ We skip 1-ary tuple because it is GHC.Tuple.Unit, and we don't want it.

instance RecFromTuple (Rec f '[a]) where
  type IsoRecTuple (Rec f '[a]) = f a
  recFromTuple :: IsoRecTuple (Rec f '[a]) -> Rec f '[a]
recFromTuple IsoRecTuple (Rec f '[a])
a = f a
IsoRecTuple (Rec f '[a])
a f a -> Rec f '[] -> Rec f '[a]
forall u (a :: u -> *) (r :: u) (rs :: [u]).
a r -> Rec a rs -> Rec a (r : rs)
:& Rec f '[]
forall u (a :: u -> *). Rec a '[]
RNil