{-# LANGUAGE DataKinds    #-}
{-# LANGUAGE Trustworthy  #-}
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_GHC -Wno-orphans #-}

{-# OPTIONS_HADDOCK show-extensions #-}

-- |
-- Copyright   :  Kazuki Okamoto
-- License     :  see LICENSE
-- Maintainer  :  kazuki.okamoto@kakkun61.com
-- Stability   :  experimental
-- Portability :  GHC
--
-- Single homotuples.

module Data.Tuple.Homotuple.OneTuple () where

import Data.Tuple.Homotuple (Homotuple, errorLengthMismatch)
import Data.Tuple.OneTuple  (OneTuple (OneTuple))
import GHC.Exts             (IsList (Item, fromList, toList))

type instance Homotuple 1 a = OneTuple a

instance IsList (OneTuple a) where
  type Item (OneTuple a) = a
  fromList :: [Item (OneTuple a)] -> OneTuple a
fromList [Item (OneTuple a)
a] = a -> OneTuple a
forall a. a -> OneTuple a
OneTuple a
Item (OneTuple a)
a
  fromList [Item (OneTuple a)]
_   = OneTuple a
forall a. HasCallStack => a
errorLengthMismatch
  toList :: OneTuple a -> [Item (OneTuple a)]
toList (OneTuple a
a) = [a
Item (OneTuple a)
a]