list-tuple (empty) → 0.1.0.0
raw patch · 12 files changed
+2911/−0 lines, 12 filesdep +OneTupledep +Onlydep +basebuild-type:Customsetup-changed
Dependencies added: OneTuple, Only, base, deepseq, hspec, list-tuple, should-not-typecheck, single-tuple, text
Files
- ChangeLog.md +7/−0
- LICENSE +13/−0
- README.md +1/−0
- Setup.hs +123/−0
- list-tuple.cabal +73/−0
- src/Data/Tuple/List.hs +1805/−0
- src/Data/Tuple/List/Identity.hs +71/−0
- src/Data/Tuple/List/OneTuple.hs +71/−0
- src/Data/Tuple/List/Only.hs +71/−0
- test/Data/Tuple/List/IdentitySpec.hs +136/−0
- test/Data/Tuple/ListSpec.hs +539/−0
- test/Spec.hs +1/−0
+ ChangeLog.md view
@@ -0,0 +1,7 @@+# Changelog for list-tuple++## 0.1.0.0++2019.10.10++Release.
+ LICENSE view
@@ -0,0 +1,13 @@+Copyright 2019 Kazuki Okamoto++Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.
+ README.md view
@@ -0,0 +1,1 @@+# homotuple
+ Setup.hs view
@@ -0,0 +1,123 @@+import Prelude hiding (head, init, last, reverse, tail)+import qualified Prelude++import Data.Char (isDigit)+import Data.Foldable (for_)+import Data.List (intercalate, intersperse, isPrefixOf, replicate, stripPrefix)+import Distribution.Simple (Args, UserHooks (preBuild), defaultMainWithHooks, simpleUserHooks)+import Distribution.Simple.Setup (BuildFlags)+import Distribution.Types.HookedBuildInfo (HookedBuildInfo, emptyHookedBuildInfo)+import System.Directory (copyFile, createDirectoryIfMissing, getTemporaryDirectory, removeFile)+import System.IO (Handle, IOMode (ReadMode), hClose, hGetLine, hIsEOF, hPutStrLn,+ hSetNewlineMode, noNewlineTranslation, openTempFile, stdin, withFile)++main :: IO ()+main =+ defaultMainWithHooks+ simpleUserHooks+ { preBuild = preProcessListTuple }++preProcessListTuple :: Args -> BuildFlags -> IO HookedBuildInfo+preProcessListTuple _ _ = do+ let+ dir = "src/Data/Tuple"+ file = "List.hs"+ srcPath = dir ++ "/" ++ file+ templatePath = "template/List.hs"+ templateAtPath = "template/ListAt.hs"+ tempPath <-+ withFile srcPath ReadMode $ \src -> do+ tempDir <- (++ "/list-tuple") <$> getTemporaryDirectory+ createDirectoryIfMissing True tempDir+ (tempPath, temp) <- openTempFile tempDir file+ putStrLn $ "temporaly file: " ++ tempPath+ hSetNewlineMode src noNewlineTranslation+ hSetNewlineMode temp noNewlineTranslation+ hSetNewlineMode stdin noNewlineTranslation+ template <- lines <$> readFile templatePath+ templateAt <- lines <$> readFile templateAtPath+ loop src temp template templateAt+ hClose temp+ pure tempPath+ copyFile tempPath srcPath+ removeFile tempPath+ pure emptyHookedBuildInfo+ where+ loop :: Handle -> Handle -> [String] -> [String] -> IO ()+ loop src temp template templateAt =+ go+ where+ go = do+ eof <- hIsEOF src+ if eof+ then pure ()+ else do+ line <- hGetLine src+ for_ (preprocess line template templateAt) (hPutStrLn temp)+ go++ preprocess :: String -> [String] -> [String] -> [String]+ preprocess line template templateAt+ | Just rest <- stripPrefix "---- embed " line+ , let n = read $ takeWhile isDigit rest+ = embed n template templateAt+ | otherwise = [line]++ embed :: Word -> [String] -> [String] -> [String]+ embed l template templateAt+ | l >= 3 = concatMap go template+ | otherwise = error "length must be larger than or equal to 3"+ where+ go "" = [""]+ go t+ | Just rest <- stripPrefix "<tuple>" t = [tuple ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<cons>" t = [cons ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<tail>" t = [tail ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<init>" t = [init ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<last>" t = [last ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<length>" t = [length ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<tuple-head>" t = [tupleHead ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<tuple-tail>" t = [tupleTail ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<tuple-init>" t = [tupleInit ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<tuple-last>" t = [tupleLast ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<cons>" t = [cons ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<reverse>" t = [reverse ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<" t = error $ "unknown tag: " ++ takeWhile (/= '>') rest+ | Just _ <- stripPrefix "---- has-at" t+ = concatMap go $ concat $ intersperse [""] $ embedAt <$> [0 .. l - 1]+ | Just rest <- stripPrefix "-" t = ["-" ++ Prelude.head (go rest)]+ | (s, rest) <- span ((&&) <$> (/= '<') <*> (/= '-')) t = [s ++ Prelude.head (go rest)]+ n = fromIntegral l+ m = n - 1+ tuple = paren $ take n abc+ tail = paren $ take m $ Prelude.tail abc+ init = paren $ take m abc+ last = [last']+ length = show l+ tupleHead = paren $ take n $ 'a' : unders+ tupleTail = paren $ take n $ '_' : Prelude.tail abc+ tupleInit = paren $ Prelude.reverse $ '_' : zy+ tupleLast = paren $ Prelude.reverse $ take n $ last' : unders+ cons = "(" ++ replicate m ',' ++ ")"+ paren xs = "(" ++ intercalate ", " ((: []) <$> xs) ++ ")"+ abc = ['a' ..]+ unders = repeat '_'+ last' = abc !! m+ zy = Prelude.reverse (take m abc)+ zyx = Prelude.reverse (take n abc)+ reverse = paren $ zyx++ embedAt :: Word -> [String]+ embedAt at =+ go <$> templateAt+ where+ go "" = ""+ go t+ | Just rest <- stripPrefix "<at>" t = show at ++ go rest+ | Just rest <- stripPrefix "<item>" t = item ++ go rest+ | Just rest <- stripPrefix "<tuple-at>" t = tupleAt ++ go rest+ | Just rest <- stripPrefix "<" t = "<" ++ go rest+ | (s, rest) <- span (/= '<') t = s ++ go rest+ at' = fromIntegral at+ item = [abc !! at']+ tupleAt = paren $ take at' unders ++ item ++ take (n - at' - 1) unders
+ list-tuple.cabal view
@@ -0,0 +1,73 @@+cabal-version: 1.24 ++-- This file has been generated from package.yaml by hpack version 0.31.1.+--+-- see: https://github.com/sol/hpack+--+-- hash: 8483043ca4b85bbe594829f7a49fa181056f2cfff834a8c26fe67d0562b4d8cc++name: list-tuple+version: 0.1.0.0+synopsis: List-like operations for tuples+description: List-like operations for tuples+category: Data+homepage: https://github.com/kakkun61/tuple#readme+bug-reports: https://github.com/kakkun61/tuple/issues+author: Kazuki Okamoto+maintainer: kazuki.okamoto@kakkun61.com+copyright: 2019 Kazuki Okamoto+license: Apache+license-file: LICENSE+build-type: Custom+extra-source-files:+ README.md+ ChangeLog.md++source-repository head+ type: git+ location: https://github.com/kakkun61/tuple++custom-setup+ setup-depends:+ Cabal+ , base+ , directory++library+ exposed-modules:+ Data.Tuple.List+ Data.Tuple.List.Identity+ Data.Tuple.List.OneTuple+ Data.Tuple.List.Only+ other-modules:+ Paths_list_tuple+ hs-source-dirs:+ src+ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Wmissing-import-lists -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -Wno-unticked-promoted-constructors+ build-depends:+ OneTuple >=0.2 && <0.3+ , Only >=0.1 && <0.2+ , base >=4.12 && <4.13+ , single-tuple >=0.1 && <0.2+ default-language: Haskell2010++test-suite test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ other-modules:+ Data.Tuple.List.IdentitySpec+ Data.Tuple.ListSpec+ Paths_list_tuple+ hs-source-dirs:+ test+ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Wmissing-import-lists -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -Wno-unticked-promoted-constructors -threaded -rtsopts -with-rtsopts=-N -Wno-missing-export-lists -Wno-missing-import-lists+ build-depends:+ Only+ , base >=4.12 && <4.13+ , deepseq+ , hspec+ , list-tuple+ , should-not-typecheck+ , single-tuple+ , text+ default-language: Haskell2010
+ src/Data/Tuple/List.hs view
@@ -0,0 +1,1805 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE Safe #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeFamilyDependencies #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE ViewPatterns #-}++{-# OPTIONS_GHC -Wno-redundant-constraints #-}++{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Copyright : Kazuki Okamoto+-- License : see LICENSE+-- Maintainer : kazuki.okamoto@kakkun61.com+-- Stability : experimental+-- Portability : GHC+--+-- List-like operations for tuples.+--+-- This is a bit tricky of classes because Haskell does not have 1-tuples.+-- If you use 'Data.Tuple.Only.Only', 'Data.Tuple.OneTuple.OneTuple' or 'Data.Functor.Identity.Identity' as 1-tuples,+-- import @Data.Tuple.List.Only@, @Data.Tuple.List.OneTuple@ or @Data.Tuple.List.Identity@ respectively+-- and classes without a prime (dash) symbol, for examle 'HasHead'', are useful,+-- you can also use classes with a prime (dash) symbol.+-- If you use 'Data.Tuple.Single.Single' class for polymorphic 1-tuples, you should use classes with a prime (dash) symbol.++module Data.Tuple.List+ ( -- * Basic functions+ -- ** Type families+ Cons+ , Head+ , Last+ , Tail+ , Init+ , Length+ -- ** Type classes+ -- This clases are for all n-tuples including abstract 1-tuples, 2-tuples.+ , HasHead' (..)+ , HasLast' (..)+ , HasTail' (..)+ , HasInit' (..)+ , HasCons' (..)+ , HasUncons' (..)+ -- ** More concrete type classes+ -- This classes are for n-tuples (n ≦ 2) and for concrete 1-tuples, 2-tupes.+ , HasHead (..)+ , HasLast (..)+ , HasTail (..)+ , HasInit (..)+ , HasCons (..)+ , HasUncons (..)+ , HasLength (..)+ -- ** Patterns+ , pattern Null+ , pattern Cons'+ , pattern Cons+ -- * List transfomations+ , Reverse+ , HasReverse (..)+ , HasReverse' (..)+ -- * Indexing tuples+ , type (!!)+ , HasAt' (..)+ , HasAt (..)+ ) where++import Prelude (Integral, error, fromInteger, id, ($))++import Data.Functor.Identity (Identity)+import Data.Kind (Type)+import Data.Proxy (Proxy (Proxy))+import Data.Tuple.OneTuple (OneTuple)+import Data.Tuple.Only (Only)+import Data.Tuple.Single (Single (unwrap, wrap))+import GHC.TypeLits (ErrorMessage (Text), KnownNat, Nat, TypeError, natVal)++-- Basic functions++type family Cons a u :: Type+type family Head t :: Type+type family Tail t :: Type+type family Init t :: Type+type family Last t :: Type+type family Length t :: Nat++class HasHead' t a where+ head' :: t -> a++class HasTail' t u where+ tail' :: t -> u++class HasInit' t s where+ init' :: t -> s++class HasLast' t z where+ last' :: t -> z++class HasCons' t a u where+ cons' :: a -> u -> t++class HasUncons' t a u where+ uncons' :: t -> (a, u)++class HasHead t where+ head :: t -> Head t+ default head :: HasHead' t (Head t) => t -> Head t+ head = head'++class HasTail t where+ tail :: t -> Tail t+ default tail :: HasTail' t (Tail t) => t -> Tail t+ tail = tail'++class HasInit t where+ init :: t -> Init t+ default init :: HasInit' t (Init t) => t -> Init t+ init = init'++class HasLast t where+ last :: t -> Last t+ default last :: HasLast' t (Last t) => t -> Last t+ last = last'++class HasCons a u where+ cons :: a -> u -> Cons a u+ default cons :: HasCons' (Cons a u) a u => a -> u -> Cons a u+ cons = cons'++class HasUncons t where+ uncons :: t -> (Head t, Tail t)+ default uncons :: HasUncons' t (Head t) (Tail t) => t -> (Head t, Tail t)+ uncons = uncons'++class HasLength t where+ length :: Integral n => t -> n+ default length :: (Integral n, KnownNat (Length t)) => t -> n+ length _ = fromInteger $ natVal (Proxy :: Proxy (Length t))++pattern Null :: Length t ~ 0 => t+pattern Null <- _++pattern Cons' :: (HasCons' t a u, HasUncons' t a u) => a -> u -> t+pattern Cons' a u <- (uncons' -> (a, u)) where+ Cons' a u = cons' a u++pattern Cons :: (HasCons a u, HasUncons t, t ~ Cons a u, a ~ Head t, u ~ Tail t) => a -> u -> t+pattern Cons a u <- (uncons -> (a, u)) where+ Cons a u = cons a u++-- List transformations++type family Reverse t = (r :: Type) | r -> t++class HasReverse' t r where+ reverse' :: t -> r++class HasReverse t where+ reverse :: t -> Reverse t+ default reverse :: HasReverse' t (Reverse t) => t -> Reverse t+ reverse = reverse'++-- Indexing tuples++type family t !! (n :: Nat) :: Type++class HasAt' t (n :: Nat) e where+ (!!!) :: t -> proxy n -> e+ t !!! _ = at' @t @n @e t+ at' :: t -> e+ at' t = t !!! (Proxy :: Proxy n)++class HasAt t (n :: Nat) where+ (!!) :: t -> proxy n -> t !! n+ default (!!) :: HasAt' t n (t !! n) => t -> proxy n -> t !! n+ (!!) = (!!!)+ at :: t -> t !! n+ at t = t !! (Proxy :: Proxy n)++-- 0++--- Unit++type instance Head () = TypeError (Text "empty tuple")+type instance Tail () = TypeError (Text "empty tuple")+type instance Init () = TypeError (Text "empty tuple")+type instance Last () = TypeError (Text "empty tuple")+type instance Length () = 0++instance HasLength ()++{-# COMPLETE Null :: () #-}++type instance Reverse () = ()++instance HasReverse' () () where+ reverse' = id++instance HasReverse ()++--- Proxy++type instance Head (Proxy a) = TypeError (Text "empty tuple")+type instance Tail (Proxy a) = TypeError (Text "empty tuple")+type instance Init (Proxy a) = TypeError (Text "empty tuple")+type instance Last (Proxy a) = TypeError (Text "empty tuple")+type instance Length (Proxy a) = 0++instance TypeError (Text "empty tuple") => HasTail' (Proxy a) b where+ tail' = error "never reach here"++instance TypeError (Text "empty tuple") => HasInit' (Proxy a) b where+ init' = error "never reach here"++instance HasLength (Proxy a)++{-# COMPLETE Null :: Proxy #-}++type instance Reverse (Proxy a) = (Proxy a)++instance {-# OVERLAPPING #-} HasReverse' (Proxy a) (Proxy a) where+ reverse' = id++instance HasReverse (Proxy a)++-- 1++instance {-# OVERLAPPABLE #-} (Single c, t ~ c a) => HasHead' t a where+ head' = unwrap++instance {-# OVERLAPPABLE #-} (Single c, b ~ ()) => HasTail' (c a) b where+ tail' _ = ()++instance {-# OVERLAPPABLE #-} (Single c, b ~ ()) => HasInit' (c a) b where+ init' _ = ()++instance {-# OVERLAPPABLE #-} Single c => HasLast' (c a) a where+ last' = unwrap++instance Single c => HasCons' (c a) a () where+ cons' a () = wrap a++instance Single c => HasUncons' (c a) a () where+ uncons' t = (unwrap t, ())++{-# COMPLETE Cons' :: Identity #-}+{-# COMPLETE Cons' :: OneTuple #-}+{-# COMPLETE Cons' :: Only #-}+{-# COMPLETE Cons :: Identity #-}+{-# COMPLETE Cons :: OneTuple #-}+{-# COMPLETE Cons :: Only #-}++instance {-# OVERLAPPABLE #-} Single c => HasLength (c a) where+ length _ = 1++instance {-# OVERLAPPABLE #-} (Single c0, Single c1, c0 ~ c1, a ~ b) => HasReverse' (c0 a) (c1 b) where+ reverse' = id++instance {-# OVERLAPPABLE #-} (Single c, a ~ b) => HasAt' (c a) 0 b where+ t !!! _ = unwrap t++-- 2++type instance Head (a, b) = a+type instance Last (a, b) = b+type instance Length (a, b) = 2++instance HasHead' (a, b) a where+ head' (a, _) = a++instance Single c => HasTail' (a, b) (c b) where+ tail' (_, b) = wrap b++instance Single c => HasInit' (a, b) (c a) where+ init' (a, _) = wrap a++instance HasLast' (a, b) b where+ last' (_, b) = b++instance Single c => HasCons' (a, b) a (c b) where+ cons' a u = (a, unwrap u)++instance Single c => HasUncons' (a, b) a (c b) where+ uncons' (a, b) = (a, wrap b)++instance HasHead (a, b)++instance HasLast (a, b)++instance HasLength (a, b)++{-# COMPLETE Cons' :: (,) #-}+{-# COMPLETE Cons :: (,) #-}++type instance Reverse (a, b) = (b, a)++instance HasReverse' (a, b) (b, a) where+ reverse' (a, b) = (b, a)++instance HasReverse (a, b)++type instance (a, b) !! 0 = a++instance HasAt' (a, b) 0 a where+ (a, _) !!! _ = a++instance HasAt (a, b) 0++type instance (a, b) !! 1 = b++instance HasAt' (a, b) 1 b where+ (_, b) !!! _ = b++instance HasAt (a, b) 1++-- 3++type instance Cons a (b, c) = (a, b, c)+type instance Head (a, b, c) = a+type instance Tail (a, b, c) = (b, c)+type instance Init (a, b, c) = (a, b)+type instance Last (a, b, c) = c+type instance Length (a, b, c) = 3++instance HasHead' (a, b, c) a where+ head' (a, _, _) = a++instance HasTail' (a, b, c) (b, c) where+ tail' (_, b, c) = (b, c)++instance HasInit' (a, b, c) (a, b) where+ init' (a, b, _) = (a, b)++instance HasLast' (a, b, c) c where+ last' (_, _, c) = c++instance HasCons' (a, b, c) a (b, c) where+ cons' a (b, c) = (a, b, c)++instance HasUncons' (a, b, c) a (b, c) where+ uncons' (a, b, c) = (a, (b, c))++instance HasHead (a, b, c)++instance HasTail (a, b, c)++instance HasInit (a, b, c)++instance HasLast (a, b, c)++instance HasCons a (b, c)++instance HasUncons (a, b, c)++instance HasLength (a, b, c)++{-# COMPLETE Cons' :: (,,) #-}+{-# COMPLETE Cons :: (,,) #-}++type instance Reverse (a, b, c) = (c, b, a)++instance HasReverse' (a, b, c) (c, b, a) where+ reverse' (a, b, c) = (c, b, a)++instance HasReverse (a, b, c)++type instance (a, b, c) !! 0 = a++instance HasAt' (a, b, c) 0 a where+ (a, _, _) !!! _ = a++instance HasAt (a, b, c) 0++type instance (a, b, c) !! 1 = b++instance HasAt' (a, b, c) 1 b where+ (_, b, _) !!! _ = b++instance HasAt (a, b, c) 1++type instance (a, b, c) !! 2 = c++instance HasAt' (a, b, c) 2 c where+ (_, _, c) !!! _ = c++instance HasAt (a, b, c) 2++-- 4++type instance Cons a (b, c, d) = (a, b, c, d)+type instance Head (a, b, c, d) = a+type instance Tail (a, b, c, d) = (b, c, d)+type instance Init (a, b, c, d) = (a, b, c)+type instance Last (a, b, c, d) = d+type instance Length (a, b, c, d) = 4++instance HasHead' (a, b, c, d) a where+ head' (a, _, _, _) = a++instance HasTail' (a, b, c, d) (b, c, d) where+ tail' (_, b, c, d) = (b, c, d)++instance HasInit' (a, b, c, d) (a, b, c) where+ init' (a, b, c, _) = (a, b, c)++instance HasLast' (a, b, c, d) d where+ last' (_, _, _, d) = d++instance HasCons' (a, b, c, d) a (b, c, d) where+ cons' a (b, c, d) = (a, b, c, d)++instance HasUncons' (a, b, c, d) a (b, c, d) where+ uncons' (a, b, c, d) = (a, (b, c, d))++instance HasHead (a, b, c, d)++instance HasTail (a, b, c, d)++instance HasInit (a, b, c, d)++instance HasLast (a, b, c, d)++instance HasCons a (b, c, d)++instance HasUncons (a, b, c, d)++instance HasLength (a, b, c, d)++{-# COMPLETE Cons' :: (,,,) #-}+{-# COMPLETE Cons :: (,,,) #-}++type instance Reverse (a, b, c, d) = (d, c, b, a)++instance HasReverse' (a, b, c, d) (d, c, b, a) where+ reverse' (a, b, c, d) = (d, c, b, a)++instance HasReverse (a, b, c, d)++type instance (a, b, c, d) !! 0 = a++instance HasAt' (a, b, c, d) 0 a where+ (a, _, _, _) !!! _ = a++instance HasAt (a, b, c, d) 0++type instance (a, b, c, d) !! 1 = b++instance HasAt' (a, b, c, d) 1 b where+ (_, b, _, _) !!! _ = b++instance HasAt (a, b, c, d) 1++type instance (a, b, c, d) !! 2 = c++instance HasAt' (a, b, c, d) 2 c where+ (_, _, c, _) !!! _ = c++instance HasAt (a, b, c, d) 2++type instance (a, b, c, d) !! 3 = d++instance HasAt' (a, b, c, d) 3 d where+ (_, _, _, d) !!! _ = d++instance HasAt (a, b, c, d) 3++-- 5++type instance Cons a (b, c, d, e) = (a, b, c, d, e)+type instance Head (a, b, c, d, e) = a+type instance Tail (a, b, c, d, e) = (b, c, d, e)+type instance Init (a, b, c, d, e) = (a, b, c, d)+type instance Last (a, b, c, d, e) = e+type instance Length (a, b, c, d, e) = 5++instance HasHead' (a, b, c, d, e) a where+ head' (a, _, _, _, _) = a++instance HasTail' (a, b, c, d, e) (b, c, d, e) where+ tail' (_, b, c, d, e) = (b, c, d, e)++instance HasInit' (a, b, c, d, e) (a, b, c, d) where+ init' (a, b, c, d, _) = (a, b, c, d)++instance HasLast' (a, b, c, d, e) e where+ last' (_, _, _, _, e) = e++instance HasCons' (a, b, c, d, e) a (b, c, d, e) where+ cons' a (b, c, d, e) = (a, b, c, d, e)++instance HasUncons' (a, b, c, d, e) a (b, c, d, e) where+ uncons' (a, b, c, d, e) = (a, (b, c, d, e))++instance HasHead (a, b, c, d, e)++instance HasTail (a, b, c, d, e)++instance HasInit (a, b, c, d, e)++instance HasLast (a, b, c, d, e)++instance HasCons a (b, c, d, e)++instance HasUncons (a, b, c, d, e)++instance HasLength (a, b, c, d, e)++{-# COMPLETE Cons' :: (,,,,) #-}+{-# COMPLETE Cons :: (,,,,) #-}++type instance Reverse (a, b, c, d, e) = (e, d, c, b, a)++instance HasReverse' (a, b, c, d, e) (e, d, c, b, a) where+ reverse' (a, b, c, d, e) = (e, d, c, b, a)++instance HasReverse (a, b, c, d, e)++type instance (a, b, c, d, e) !! 0 = a++instance HasAt' (a, b, c, d, e) 0 a where+ (a, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e) 0++type instance (a, b, c, d, e) !! 1 = b++instance HasAt' (a, b, c, d, e) 1 b where+ (_, b, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e) 1++type instance (a, b, c, d, e) !! 2 = c++instance HasAt' (a, b, c, d, e) 2 c where+ (_, _, c, _, _) !!! _ = c++instance HasAt (a, b, c, d, e) 2++type instance (a, b, c, d, e) !! 3 = d++instance HasAt' (a, b, c, d, e) 3 d where+ (_, _, _, d, _) !!! _ = d++instance HasAt (a, b, c, d, e) 3++type instance (a, b, c, d, e) !! 4 = e++instance HasAt' (a, b, c, d, e) 4 e where+ (_, _, _, _, e) !!! _ = e++instance HasAt (a, b, c, d, e) 4++-- 6++type instance Cons a (b, c, d, e, f) = (a, b, c, d, e, f)+type instance Head (a, b, c, d, e, f) = a+type instance Tail (a, b, c, d, e, f) = (b, c, d, e, f)+type instance Init (a, b, c, d, e, f) = (a, b, c, d, e)+type instance Last (a, b, c, d, e, f) = f+type instance Length (a, b, c, d, e, f) = 6++instance HasHead' (a, b, c, d, e, f) a where+ head' (a, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f) (b, c, d, e, f) where+ tail' (_, b, c, d, e, f) = (b, c, d, e, f)++instance HasInit' (a, b, c, d, e, f) (a, b, c, d, e) where+ init' (a, b, c, d, e, _) = (a, b, c, d, e)++instance HasLast' (a, b, c, d, e, f) f where+ last' (_, _, _, _, _, f) = f++instance HasCons' (a, b, c, d, e, f) a (b, c, d, e, f) where+ cons' a (b, c, d, e, f) = (a, b, c, d, e, f)++instance HasUncons' (a, b, c, d, e, f) a (b, c, d, e, f) where+ uncons' (a, b, c, d, e, f) = (a, (b, c, d, e, f))++instance HasHead (a, b, c, d, e, f)++instance HasTail (a, b, c, d, e, f)++instance HasInit (a, b, c, d, e, f)++instance HasLast (a, b, c, d, e, f)++instance HasCons a (b, c, d, e, f)++instance HasUncons (a, b, c, d, e, f)++instance HasLength (a, b, c, d, e, f)++{-# COMPLETE Cons' :: (,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,) #-}++type instance Reverse (a, b, c, d, e, f) = (f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f) (f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f) = (f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f)++type instance (a, b, c, d, e, f) !! 0 = a++instance HasAt' (a, b, c, d, e, f) 0 a where+ (a, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f) 0++type instance (a, b, c, d, e, f) !! 1 = b++instance HasAt' (a, b, c, d, e, f) 1 b where+ (_, b, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f) 1++type instance (a, b, c, d, e, f) !! 2 = c++instance HasAt' (a, b, c, d, e, f) 2 c where+ (_, _, c, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f) 2++type instance (a, b, c, d, e, f) !! 3 = d++instance HasAt' (a, b, c, d, e, f) 3 d where+ (_, _, _, d, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f) 3++type instance (a, b, c, d, e, f) !! 4 = e++instance HasAt' (a, b, c, d, e, f) 4 e where+ (_, _, _, _, e, _) !!! _ = e++instance HasAt (a, b, c, d, e, f) 4++type instance (a, b, c, d, e, f) !! 5 = f++instance HasAt' (a, b, c, d, e, f) 5 f where+ (_, _, _, _, _, f) !!! _ = f++instance HasAt (a, b, c, d, e, f) 5++-- 7++type instance Cons a (b, c, d, e, f, g) = (a, b, c, d, e, f, g)+type instance Head (a, b, c, d, e, f, g) = a+type instance Tail (a, b, c, d, e, f, g) = (b, c, d, e, f, g)+type instance Init (a, b, c, d, e, f, g) = (a, b, c, d, e, f)+type instance Last (a, b, c, d, e, f, g) = g+type instance Length (a, b, c, d, e, f, g) = 7++instance HasHead' (a, b, c, d, e, f, g) a where+ head' (a, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g) (b, c, d, e, f, g) where+ tail' (_, b, c, d, e, f, g) = (b, c, d, e, f, g)++instance HasInit' (a, b, c, d, e, f, g) (a, b, c, d, e, f) where+ init' (a, b, c, d, e, f, _) = (a, b, c, d, e, f)++instance HasLast' (a, b, c, d, e, f, g) g where+ last' (_, _, _, _, _, _, g) = g++instance HasCons' (a, b, c, d, e, f, g) a (b, c, d, e, f, g) where+ cons' a (b, c, d, e, f, g) = (a, b, c, d, e, f, g)++instance HasUncons' (a, b, c, d, e, f, g) a (b, c, d, e, f, g) where+ uncons' (a, b, c, d, e, f, g) = (a, (b, c, d, e, f, g))++instance HasHead (a, b, c, d, e, f, g)++instance HasTail (a, b, c, d, e, f, g)++instance HasInit (a, b, c, d, e, f, g)++instance HasLast (a, b, c, d, e, f, g)++instance HasCons a (b, c, d, e, f, g)++instance HasUncons (a, b, c, d, e, f, g)++instance HasLength (a, b, c, d, e, f, g)++{-# COMPLETE Cons' :: (,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g) = (g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g) (g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g) = (g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g)++type instance (a, b, c, d, e, f, g) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g) 0 a where+ (a, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g) 0++type instance (a, b, c, d, e, f, g) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g) 1 b where+ (_, b, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g) 1++type instance (a, b, c, d, e, f, g) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g) 2 c where+ (_, _, c, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g) 2++type instance (a, b, c, d, e, f, g) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g) 3 d where+ (_, _, _, d, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g) 3++type instance (a, b, c, d, e, f, g) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g) 4 e where+ (_, _, _, _, e, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g) 4++type instance (a, b, c, d, e, f, g) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g) 5 f where+ (_, _, _, _, _, f, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g) 5++type instance (a, b, c, d, e, f, g) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g) 6 g where+ (_, _, _, _, _, _, g) !!! _ = g++instance HasAt (a, b, c, d, e, f, g) 6++-- 8++type instance Cons a (b, c, d, e, f, g, h) = (a, b, c, d, e, f, g, h)+type instance Head (a, b, c, d, e, f, g, h) = a+type instance Tail (a, b, c, d, e, f, g, h) = (b, c, d, e, f, g, h)+type instance Init (a, b, c, d, e, f, g, h) = (a, b, c, d, e, f, g)+type instance Last (a, b, c, d, e, f, g, h) = h+type instance Length (a, b, c, d, e, f, g, h) = 8++instance HasHead' (a, b, c, d, e, f, g, h) a where+ head' (a, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h) (b, c, d, e, f, g, h) where+ tail' (_, b, c, d, e, f, g, h) = (b, c, d, e, f, g, h)++instance HasInit' (a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g) where+ init' (a, b, c, d, e, f, g, _) = (a, b, c, d, e, f, g)++instance HasLast' (a, b, c, d, e, f, g, h) h where+ last' (_, _, _, _, _, _, _, h) = h++instance HasCons' (a, b, c, d, e, f, g, h) a (b, c, d, e, f, g, h) where+ cons' a (b, c, d, e, f, g, h) = (a, b, c, d, e, f, g, h)++instance HasUncons' (a, b, c, d, e, f, g, h) a (b, c, d, e, f, g, h) where+ uncons' (a, b, c, d, e, f, g, h) = (a, (b, c, d, e, f, g, h))++instance HasHead (a, b, c, d, e, f, g, h)++instance HasTail (a, b, c, d, e, f, g, h)++instance HasInit (a, b, c, d, e, f, g, h)++instance HasLast (a, b, c, d, e, f, g, h)++instance HasCons a (b, c, d, e, f, g, h)++instance HasUncons (a, b, c, d, e, f, g, h)++instance HasLength (a, b, c, d, e, f, g, h)++{-# COMPLETE Cons' :: (,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h) = (h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h) (h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h) = (h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h)++type instance (a, b, c, d, e, f, g, h) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h) 0 a where+ (a, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h) 0++type instance (a, b, c, d, e, f, g, h) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h) 1 b where+ (_, b, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h) 1++type instance (a, b, c, d, e, f, g, h) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h) 2 c where+ (_, _, c, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h) 2++type instance (a, b, c, d, e, f, g, h) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h) 3 d where+ (_, _, _, d, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h) 3++type instance (a, b, c, d, e, f, g, h) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h) 4 e where+ (_, _, _, _, e, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h) 4++type instance (a, b, c, d, e, f, g, h) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h) 5 f where+ (_, _, _, _, _, f, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h) 5++type instance (a, b, c, d, e, f, g, h) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h) 6 g where+ (_, _, _, _, _, _, g, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h) 6++type instance (a, b, c, d, e, f, g, h) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h) 7 h where+ (_, _, _, _, _, _, _, h) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h) 7++-- 9++type instance Cons a (b, c, d, e, f, g, h, i) = (a, b, c, d, e, f, g, h, i)+type instance Head (a, b, c, d, e, f, g, h, i) = a+type instance Tail (a, b, c, d, e, f, g, h, i) = (b, c, d, e, f, g, h, i)+type instance Init (a, b, c, d, e, f, g, h, i) = (a, b, c, d, e, f, g, h)+type instance Last (a, b, c, d, e, f, g, h, i) = i+type instance Length (a, b, c, d, e, f, g, h, i) = 9++instance HasHead' (a, b, c, d, e, f, g, h, i) a where+ head' (a, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i) (b, c, d, e, f, g, h, i) where+ tail' (_, b, c, d, e, f, g, h, i) = (b, c, d, e, f, g, h, i)++instance HasInit' (a, b, c, d, e, f, g, h, i) (a, b, c, d, e, f, g, h) where+ init' (a, b, c, d, e, f, g, h, _) = (a, b, c, d, e, f, g, h)++instance HasLast' (a, b, c, d, e, f, g, h, i) i where+ last' (_, _, _, _, _, _, _, _, i) = i++instance HasCons' (a, b, c, d, e, f, g, h, i) a (b, c, d, e, f, g, h, i) where+ cons' a (b, c, d, e, f, g, h, i) = (a, b, c, d, e, f, g, h, i)++instance HasUncons' (a, b, c, d, e, f, g, h, i) a (b, c, d, e, f, g, h, i) where+ uncons' (a, b, c, d, e, f, g, h, i) = (a, (b, c, d, e, f, g, h, i))++instance HasHead (a, b, c, d, e, f, g, h, i)++instance HasTail (a, b, c, d, e, f, g, h, i)++instance HasInit (a, b, c, d, e, f, g, h, i)++instance HasLast (a, b, c, d, e, f, g, h, i)++instance HasCons a (b, c, d, e, f, g, h, i)++instance HasUncons (a, b, c, d, e, f, g, h, i)++instance HasLength (a, b, c, d, e, f, g, h, i)++{-# COMPLETE Cons' :: (,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i) = (i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i) (i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i) = (i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i)++type instance (a, b, c, d, e, f, g, h, i) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i) 0 a where+ (a, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i) 0++type instance (a, b, c, d, e, f, g, h, i) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i) 1 b where+ (_, b, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i) 1++type instance (a, b, c, d, e, f, g, h, i) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i) 2 c where+ (_, _, c, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i) 2++type instance (a, b, c, d, e, f, g, h, i) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i) 3 d where+ (_, _, _, d, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i) 3++type instance (a, b, c, d, e, f, g, h, i) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i) 4 e where+ (_, _, _, _, e, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i) 4++type instance (a, b, c, d, e, f, g, h, i) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i) 5 f where+ (_, _, _, _, _, f, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i) 5++type instance (a, b, c, d, e, f, g, h, i) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i) 6 g where+ (_, _, _, _, _, _, g, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i) 6++type instance (a, b, c, d, e, f, g, h, i) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i) 7 h where+ (_, _, _, _, _, _, _, h, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i) 7++type instance (a, b, c, d, e, f, g, h, i) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i) 8 i where+ (_, _, _, _, _, _, _, _, i) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i) 8++-- 10++type instance Cons a (b, c, d, e, f, g, h, i, j) = (a, b, c, d, e, f, g, h, i, j)+type instance Head (a, b, c, d, e, f, g, h, i, j) = a+type instance Tail (a, b, c, d, e, f, g, h, i, j) = (b, c, d, e, f, g, h, i, j)+type instance Init (a, b, c, d, e, f, g, h, i, j) = (a, b, c, d, e, f, g, h, i)+type instance Last (a, b, c, d, e, f, g, h, i, j) = j+type instance Length (a, b, c, d, e, f, g, h, i, j) = 10++instance HasHead' (a, b, c, d, e, f, g, h, i, j) a where+ head' (a, _, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i, j) (b, c, d, e, f, g, h, i, j) where+ tail' (_, b, c, d, e, f, g, h, i, j) = (b, c, d, e, f, g, h, i, j)++instance HasInit' (a, b, c, d, e, f, g, h, i, j) (a, b, c, d, e, f, g, h, i) where+ init' (a, b, c, d, e, f, g, h, i, _) = (a, b, c, d, e, f, g, h, i)++instance HasLast' (a, b, c, d, e, f, g, h, i, j) j where+ last' (_, _, _, _, _, _, _, _, _, j) = j++instance HasCons' (a, b, c, d, e, f, g, h, i, j) a (b, c, d, e, f, g, h, i, j) where+ cons' a (b, c, d, e, f, g, h, i, j) = (a, b, c, d, e, f, g, h, i, j)++instance HasUncons' (a, b, c, d, e, f, g, h, i, j) a (b, c, d, e, f, g, h, i, j) where+ uncons' (a, b, c, d, e, f, g, h, i, j) = (a, (b, c, d, e, f, g, h, i, j))++instance HasHead (a, b, c, d, e, f, g, h, i, j)++instance HasTail (a, b, c, d, e, f, g, h, i, j)++instance HasInit (a, b, c, d, e, f, g, h, i, j)++instance HasLast (a, b, c, d, e, f, g, h, i, j)++instance HasCons a (b, c, d, e, f, g, h, i, j)++instance HasUncons (a, b, c, d, e, f, g, h, i, j)++instance HasLength (a, b, c, d, e, f, g, h, i, j)++{-# COMPLETE Cons' :: (,,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i, j) = (j, i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i, j) (j, i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i, j) = (j, i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i, j)++type instance (a, b, c, d, e, f, g, h, i, j) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 0 a where+ (a, _, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i, j) 0++type instance (a, b, c, d, e, f, g, h, i, j) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 1 b where+ (_, b, _, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i, j) 1++type instance (a, b, c, d, e, f, g, h, i, j) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 2 c where+ (_, _, c, _, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i, j) 2++type instance (a, b, c, d, e, f, g, h, i, j) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 3 d where+ (_, _, _, d, _, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i, j) 3++type instance (a, b, c, d, e, f, g, h, i, j) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 4 e where+ (_, _, _, _, e, _, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i, j) 4++type instance (a, b, c, d, e, f, g, h, i, j) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 5 f where+ (_, _, _, _, _, f, _, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i, j) 5++type instance (a, b, c, d, e, f, g, h, i, j) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 6 g where+ (_, _, _, _, _, _, g, _, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i, j) 6++type instance (a, b, c, d, e, f, g, h, i, j) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 7 h where+ (_, _, _, _, _, _, _, h, _, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i, j) 7++type instance (a, b, c, d, e, f, g, h, i, j) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 8 i where+ (_, _, _, _, _, _, _, _, i, _) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i, j) 8++type instance (a, b, c, d, e, f, g, h, i, j) !! 9 = j++instance HasAt' (a, b, c, d, e, f, g, h, i, j) 9 j where+ (_, _, _, _, _, _, _, _, _, j) !!! _ = j++instance HasAt (a, b, c, d, e, f, g, h, i, j) 9++-- 11++type instance Cons a (b, c, d, e, f, g, h, i, j, k) = (a, b, c, d, e, f, g, h, i, j, k)+type instance Head (a, b, c, d, e, f, g, h, i, j, k) = a+type instance Tail (a, b, c, d, e, f, g, h, i, j, k) = (b, c, d, e, f, g, h, i, j, k)+type instance Init (a, b, c, d, e, f, g, h, i, j, k) = (a, b, c, d, e, f, g, h, i, j)+type instance Last (a, b, c, d, e, f, g, h, i, j, k) = k+type instance Length (a, b, c, d, e, f, g, h, i, j, k) = 11++instance HasHead' (a, b, c, d, e, f, g, h, i, j, k) a where+ head' (a, _, _, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i, j, k) (b, c, d, e, f, g, h, i, j, k) where+ tail' (_, b, c, d, e, f, g, h, i, j, k) = (b, c, d, e, f, g, h, i, j, k)++instance HasInit' (a, b, c, d, e, f, g, h, i, j, k) (a, b, c, d, e, f, g, h, i, j) where+ init' (a, b, c, d, e, f, g, h, i, j, _) = (a, b, c, d, e, f, g, h, i, j)++instance HasLast' (a, b, c, d, e, f, g, h, i, j, k) k where+ last' (_, _, _, _, _, _, _, _, _, _, k) = k++instance HasCons' (a, b, c, d, e, f, g, h, i, j, k) a (b, c, d, e, f, g, h, i, j, k) where+ cons' a (b, c, d, e, f, g, h, i, j, k) = (a, b, c, d, e, f, g, h, i, j, k)++instance HasUncons' (a, b, c, d, e, f, g, h, i, j, k) a (b, c, d, e, f, g, h, i, j, k) where+ uncons' (a, b, c, d, e, f, g, h, i, j, k) = (a, (b, c, d, e, f, g, h, i, j, k))++instance HasHead (a, b, c, d, e, f, g, h, i, j, k)++instance HasTail (a, b, c, d, e, f, g, h, i, j, k)++instance HasInit (a, b, c, d, e, f, g, h, i, j, k)++instance HasLast (a, b, c, d, e, f, g, h, i, j, k)++instance HasCons a (b, c, d, e, f, g, h, i, j, k)++instance HasUncons (a, b, c, d, e, f, g, h, i, j, k)++instance HasLength (a, b, c, d, e, f, g, h, i, j, k)++{-# COMPLETE Cons' :: (,,,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i, j, k) = (k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i, j, k) (k, j, i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i, j, k) = (k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i, j, k)++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 0 a where+ (a, _, _, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 0++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 1 b where+ (_, b, _, _, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 1++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 2 c where+ (_, _, c, _, _, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 2++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 3 d where+ (_, _, _, d, _, _, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 3++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 4 e where+ (_, _, _, _, e, _, _, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 4++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 5 f where+ (_, _, _, _, _, f, _, _, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 5++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 6 g where+ (_, _, _, _, _, _, g, _, _, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 6++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 7 h where+ (_, _, _, _, _, _, _, h, _, _, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 7++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 8 i where+ (_, _, _, _, _, _, _, _, i, _, _) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 8++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 9 = j++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 9 j where+ (_, _, _, _, _, _, _, _, _, j, _) !!! _ = j++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 9++type instance (a, b, c, d, e, f, g, h, i, j, k) !! 10 = k++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k) 10 k where+ (_, _, _, _, _, _, _, _, _, _, k) !!! _ = k++instance HasAt (a, b, c, d, e, f, g, h, i, j, k) 10++-- 12++type instance Cons a (b, c, d, e, f, g, h, i, j, k, l) = (a, b, c, d, e, f, g, h, i, j, k, l)+type instance Head (a, b, c, d, e, f, g, h, i, j, k, l) = a+type instance Tail (a, b, c, d, e, f, g, h, i, j, k, l) = (b, c, d, e, f, g, h, i, j, k, l)+type instance Init (a, b, c, d, e, f, g, h, i, j, k, l) = (a, b, c, d, e, f, g, h, i, j, k)+type instance Last (a, b, c, d, e, f, g, h, i, j, k, l) = l+type instance Length (a, b, c, d, e, f, g, h, i, j, k, l) = 12++instance HasHead' (a, b, c, d, e, f, g, h, i, j, k, l) a where+ head' (a, _, _, _, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i, j, k, l) (b, c, d, e, f, g, h, i, j, k, l) where+ tail' (_, b, c, d, e, f, g, h, i, j, k, l) = (b, c, d, e, f, g, h, i, j, k, l)++instance HasInit' (a, b, c, d, e, f, g, h, i, j, k, l) (a, b, c, d, e, f, g, h, i, j, k) where+ init' (a, b, c, d, e, f, g, h, i, j, k, _) = (a, b, c, d, e, f, g, h, i, j, k)++instance HasLast' (a, b, c, d, e, f, g, h, i, j, k, l) l where+ last' (_, _, _, _, _, _, _, _, _, _, _, l) = l++instance HasCons' (a, b, c, d, e, f, g, h, i, j, k, l) a (b, c, d, e, f, g, h, i, j, k, l) where+ cons' a (b, c, d, e, f, g, h, i, j, k, l) = (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasUncons' (a, b, c, d, e, f, g, h, i, j, k, l) a (b, c, d, e, f, g, h, i, j, k, l) where+ uncons' (a, b, c, d, e, f, g, h, i, j, k, l) = (a, (b, c, d, e, f, g, h, i, j, k, l))++instance HasHead (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasTail (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasInit (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasLast (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasCons a (b, c, d, e, f, g, h, i, j, k, l)++instance HasUncons (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasLength (a, b, c, d, e, f, g, h, i, j, k, l)++{-# COMPLETE Cons' :: (,,,,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i, j, k, l) = (l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i, j, k, l) (l, k, j, i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i, j, k, l) = (l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i, j, k, l)++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 0 a where+ (a, _, _, _, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 0++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 1 b where+ (_, b, _, _, _, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 1++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 2 c where+ (_, _, c, _, _, _, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 2++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 3 d where+ (_, _, _, d, _, _, _, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 3++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 4 e where+ (_, _, _, _, e, _, _, _, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 4++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 5 f where+ (_, _, _, _, _, f, _, _, _, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 5++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 6 g where+ (_, _, _, _, _, _, g, _, _, _, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 6++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 7 h where+ (_, _, _, _, _, _, _, h, _, _, _, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 7++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 8 i where+ (_, _, _, _, _, _, _, _, i, _, _, _) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 8++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 9 = j++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 9 j where+ (_, _, _, _, _, _, _, _, _, j, _, _) !!! _ = j++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 9++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 10 = k++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 10 k where+ (_, _, _, _, _, _, _, _, _, _, k, _) !!! _ = k++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 10++type instance (a, b, c, d, e, f, g, h, i, j, k, l) !! 11 = l++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l) 11 l where+ (_, _, _, _, _, _, _, _, _, _, _, l) !!! _ = l++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l) 11++-- 13++type instance Cons a (b, c, d, e, f, g, h, i, j, k, l, m) = (a, b, c, d, e, f, g, h, i, j, k, l, m)+type instance Head (a, b, c, d, e, f, g, h, i, j, k, l, m) = a+type instance Tail (a, b, c, d, e, f, g, h, i, j, k, l, m) = (b, c, d, e, f, g, h, i, j, k, l, m)+type instance Init (a, b, c, d, e, f, g, h, i, j, k, l, m) = (a, b, c, d, e, f, g, h, i, j, k, l)+type instance Last (a, b, c, d, e, f, g, h, i, j, k, l, m) = m+type instance Length (a, b, c, d, e, f, g, h, i, j, k, l, m) = 13++instance HasHead' (a, b, c, d, e, f, g, h, i, j, k, l, m) a where+ head' (a, _, _, _, _, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i, j, k, l, m) (b, c, d, e, f, g, h, i, j, k, l, m) where+ tail' (_, b, c, d, e, f, g, h, i, j, k, l, m) = (b, c, d, e, f, g, h, i, j, k, l, m)++instance HasInit' (a, b, c, d, e, f, g, h, i, j, k, l, m) (a, b, c, d, e, f, g, h, i, j, k, l) where+ init' (a, b, c, d, e, f, g, h, i, j, k, l, _) = (a, b, c, d, e, f, g, h, i, j, k, l)++instance HasLast' (a, b, c, d, e, f, g, h, i, j, k, l, m) m where+ last' (_, _, _, _, _, _, _, _, _, _, _, _, m) = m++instance HasCons' (a, b, c, d, e, f, g, h, i, j, k, l, m) a (b, c, d, e, f, g, h, i, j, k, l, m) where+ cons' a (b, c, d, e, f, g, h, i, j, k, l, m) = (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasUncons' (a, b, c, d, e, f, g, h, i, j, k, l, m) a (b, c, d, e, f, g, h, i, j, k, l, m) where+ uncons' (a, b, c, d, e, f, g, h, i, j, k, l, m) = (a, (b, c, d, e, f, g, h, i, j, k, l, m))++instance HasHead (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasTail (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasInit (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasLast (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasCons a (b, c, d, e, f, g, h, i, j, k, l, m)++instance HasUncons (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasLength (a, b, c, d, e, f, g, h, i, j, k, l, m)++{-# COMPLETE Cons' :: (,,,,,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i, j, k, l, m) = (m, l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i, j, k, l, m) (m, l, k, j, i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i, j, k, l, m) = (m, l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i, j, k, l, m)++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 0 a where+ (a, _, _, _, _, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 0++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 1 b where+ (_, b, _, _, _, _, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 1++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 2 c where+ (_, _, c, _, _, _, _, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 2++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 3 d where+ (_, _, _, d, _, _, _, _, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 3++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 4 e where+ (_, _, _, _, e, _, _, _, _, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 4++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 5 f where+ (_, _, _, _, _, f, _, _, _, _, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 5++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 6 g where+ (_, _, _, _, _, _, g, _, _, _, _, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 6++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 7 h where+ (_, _, _, _, _, _, _, h, _, _, _, _, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 7++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 8 i where+ (_, _, _, _, _, _, _, _, i, _, _, _, _) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 8++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 9 = j++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 9 j where+ (_, _, _, _, _, _, _, _, _, j, _, _, _) !!! _ = j++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 9++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 10 = k++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 10 k where+ (_, _, _, _, _, _, _, _, _, _, k, _, _) !!! _ = k++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 10++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 11 = l++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 11 l where+ (_, _, _, _, _, _, _, _, _, _, _, l, _) !!! _ = l++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 11++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m) !! 12 = m++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m) 12 m where+ (_, _, _, _, _, _, _, _, _, _, _, _, m) !!! _ = m++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m) 12++-- 14++type instance Cons a (b, c, d, e, f, g, h, i, j, k, l, m, n) = (a, b, c, d, e, f, g, h, i, j, k, l, m, n)+type instance Head (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = a+type instance Tail (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = (b, c, d, e, f, g, h, i, j, k, l, m, n)+type instance Init (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = (a, b, c, d, e, f, g, h, i, j, k, l, m)+type instance Last (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = n+type instance Length (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = 14++instance HasHead' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) a where+ head' (a, _, _, _, _, _, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (b, c, d, e, f, g, h, i, j, k, l, m, n) where+ tail' (_, b, c, d, e, f, g, h, i, j, k, l, m, n) = (b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasInit' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (a, b, c, d, e, f, g, h, i, j, k, l, m) where+ init' (a, b, c, d, e, f, g, h, i, j, k, l, m, _) = (a, b, c, d, e, f, g, h, i, j, k, l, m)++instance HasLast' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) n where+ last' (_, _, _, _, _, _, _, _, _, _, _, _, _, n) = n++instance HasCons' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) a (b, c, d, e, f, g, h, i, j, k, l, m, n) where+ cons' a (b, c, d, e, f, g, h, i, j, k, l, m, n) = (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasUncons' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) a (b, c, d, e, f, g, h, i, j, k, l, m, n) where+ uncons' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = (a, (b, c, d, e, f, g, h, i, j, k, l, m, n))++instance HasHead (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasTail (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasInit (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasLast (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasCons a (b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasUncons (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasLength (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++{-# COMPLETE Cons' :: (,,,,,,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = (n, m, l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (n, m, l, k, j, i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) = (n, m, l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 0 a where+ (a, _, _, _, _, _, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 0++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 1 b where+ (_, b, _, _, _, _, _, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 1++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 2 c where+ (_, _, c, _, _, _, _, _, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 2++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 3 d where+ (_, _, _, d, _, _, _, _, _, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 3++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 4 e where+ (_, _, _, _, e, _, _, _, _, _, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 4++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 5 f where+ (_, _, _, _, _, f, _, _, _, _, _, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 5++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 6 g where+ (_, _, _, _, _, _, g, _, _, _, _, _, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 6++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 7 h where+ (_, _, _, _, _, _, _, h, _, _, _, _, _, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 7++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 8 i where+ (_, _, _, _, _, _, _, _, i, _, _, _, _, _) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 8++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 9 = j++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 9 j where+ (_, _, _, _, _, _, _, _, _, j, _, _, _, _) !!! _ = j++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 9++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 10 = k++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 10 k where+ (_, _, _, _, _, _, _, _, _, _, k, _, _, _) !!! _ = k++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 10++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 11 = l++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 11 l where+ (_, _, _, _, _, _, _, _, _, _, _, l, _, _) !!! _ = l++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 11++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 12 = m++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 12 m where+ (_, _, _, _, _, _, _, _, _, _, _, _, m, _) !!! _ = m++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 12++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n) !! 13 = n++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 13 n where+ (_, _, _, _, _, _, _, _, _, _, _, _, _, n) !!! _ = n++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 13++-- 15++type instance Cons a (b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)+type instance Head (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = a+type instance Tail (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (b, c, d, e, f, g, h, i, j, k, l, m, n, o)+type instance Init (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (a, b, c, d, e, f, g, h, i, j, k, l, m, n)+type instance Last (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = o+type instance Length (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = 15++instance HasHead' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a where+ head' (a, _, _, _, _, _, _, _, _, _, _, _, _, _, _) = a++instance HasTail' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) (b, c, d, e, f, g, h, i, j, k, l, m, n, o) where+ tail' (_, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasInit' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) (a, b, c, d, e, f, g, h, i, j, k, l, m, n) where+ init' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, _) = (a, b, c, d, e, f, g, h, i, j, k, l, m, n)++instance HasLast' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) o where+ last' (_, _, _, _, _, _, _, _, _, _, _, _, _, _, o) = o++instance HasCons' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a (b, c, d, e, f, g, h, i, j, k, l, m, n, o) where+ cons' a (b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasUncons' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a (b, c, d, e, f, g, h, i, j, k, l, m, n, o) where+ uncons' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (a, (b, c, d, e, f, g, h, i, j, k, l, m, n, o))++instance HasHead (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasTail (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasInit (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasLast (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasCons a (b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasUncons (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++instance HasLength (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++{-# COMPLETE Cons' :: (,,,,,,,,,,,,,,) #-}+{-# COMPLETE Cons :: (,,,,,,,,,,,,,,) #-}++type instance Reverse (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (o, n, m, l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) (o, n, m, l, k, j, i, h, g, f, e, d, c, b, a) where+ reverse' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) = (o, n, m, l, k, j, i, h, g, f, e, d, c, b, a)++instance HasReverse (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 0 = a++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 0 a where+ (a, _, _, _, _, _, _, _, _, _, _, _, _, _, _) !!! _ = a++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 0++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 1 = b++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 1 b where+ (_, b, _, _, _, _, _, _, _, _, _, _, _, _, _) !!! _ = b++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 1++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 2 = c++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 2 c where+ (_, _, c, _, _, _, _, _, _, _, _, _, _, _, _) !!! _ = c++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 2++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 3 = d++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 3 d where+ (_, _, _, d, _, _, _, _, _, _, _, _, _, _, _) !!! _ = d++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 3++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 4 = e++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 4 e where+ (_, _, _, _, e, _, _, _, _, _, _, _, _, _, _) !!! _ = e++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 4++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 5 = f++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 5 f where+ (_, _, _, _, _, f, _, _, _, _, _, _, _, _, _) !!! _ = f++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 5++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 6 = g++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 6 g where+ (_, _, _, _, _, _, g, _, _, _, _, _, _, _, _) !!! _ = g++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 6++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 7 = h++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 7 h where+ (_, _, _, _, _, _, _, h, _, _, _, _, _, _, _) !!! _ = h++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 7++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 8 = i++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 8 i where+ (_, _, _, _, _, _, _, _, i, _, _, _, _, _, _) !!! _ = i++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 8++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 9 = j++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 9 j where+ (_, _, _, _, _, _, _, _, _, j, _, _, _, _, _) !!! _ = j++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 9++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 10 = k++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 10 k where+ (_, _, _, _, _, _, _, _, _, _, k, _, _, _, _) !!! _ = k++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 10++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 11 = l++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 11 l where+ (_, _, _, _, _, _, _, _, _, _, _, l, _, _, _) !!! _ = l++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 11++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 12 = m++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 12 m where+ (_, _, _, _, _, _, _, _, _, _, _, _, m, _, _) !!! _ = m++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 12++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 13 = n++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 13 n where+ (_, _, _, _, _, _, _, _, _, _, _, _, _, n, _) !!! _ = n++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 13++type instance (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) !! 14 = o++instance HasAt' (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 14 o where+ (_, _, _, _, _, _, _, _, _, _, _, _, _, _, o) !!! _ = o++instance HasAt (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 14
+ src/Data/Tuple/List/Identity.hs view
@@ -0,0 +1,71 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE Safe #-}+{-# 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+--+-- List-like operations for 'Data.Functor.Identity.Identity'.++module Data.Tuple.List.Identity () where++import Prelude ()++import Data.Functor.Identity (Identity)+import Data.Tuple.List (type (!!), Cons, HasAt, HasCons, HasHead, HasInit, HasLast, HasLength, HasReverse,+ HasTail, HasUncons, Head, Init, Last, Length, Reverse, Tail)++-- 1++type instance Cons a () = Identity a+type instance Head (Identity a) = a+type instance Tail (Identity a) = ()+type instance Init (Identity a) = ()+type instance Last (Identity a) = a+type instance Length (Identity a) = 1++instance HasHead (Identity a)++instance HasTail (Identity a)++instance HasInit (Identity a)++instance HasLast (Identity a)++instance HasCons a ()++instance HasUncons (Identity a)++instance HasLength (Identity a)++type instance Reverse (Identity a) = Identity a++instance HasReverse (Identity a)++type instance (Identity a) !! 0 = a++instance HasAt (Identity a) 0++-- 2++type instance Cons a (Identity b) = (a, b)+type instance Tail (a, b) = Identity b+type instance Init (a, b) = Identity a++instance HasTail (a, b)++instance HasInit (a, b)++instance HasCons a (Identity b)++instance HasUncons (a, b)
+ src/Data/Tuple/List/OneTuple.hs view
@@ -0,0 +1,71 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE Safe #-}+{-# 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+--+-- List-like operations for 'Data.Tuple.OneTuple.OneTuple'.++module Data.Tuple.List.OneTuple () where++import Prelude ()++import Data.Tuple.List (type (!!), Cons, HasAt, HasCons, HasHead, HasInit, HasLast, HasLength, HasReverse, HasTail,+ HasUncons, Head, Init, Last, Length, Reverse, Tail)+import Data.Tuple.OneTuple (OneTuple)++-- 1++type instance Cons a () = OneTuple a+type instance Head (OneTuple a) = a+type instance Tail (OneTuple a) = ()+type instance Init (OneTuple a) = ()+type instance Last (OneTuple a) = a+type instance Length (OneTuple a) = 1++instance HasHead (OneTuple a)++instance HasTail (OneTuple a)++instance HasInit (OneTuple a)++instance HasLast (OneTuple a)++instance HasCons a ()++instance HasUncons (OneTuple a)++instance HasLength (OneTuple a)++type instance Reverse (OneTuple a) = OneTuple a++instance HasReverse (OneTuple a)++type instance (OneTuple a) !! 0 = a++instance HasAt (OneTuple a) 0++-- 2++type instance Cons a (OneTuple b) = (a, b)+type instance Tail (a, b) = OneTuple b+type instance Init (a, b) = OneTuple a++instance HasTail (a, b)++instance HasInit (a, b)++instance HasCons a (OneTuple b)++instance HasUncons (a, b)
+ src/Data/Tuple/List/Only.hs view
@@ -0,0 +1,71 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE Safe #-}+{-# 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+--+-- List-like operations for 'Data.Tuple.Only.Only'.++module Data.Tuple.List.Only () where++import Prelude ()++import Data.Tuple.List (type (!!), Cons, HasAt, HasCons, HasHead, HasInit, HasLast, HasLength, HasReverse, HasTail,+ HasUncons, Head, Init, Last, Length, Reverse, Tail)+import Data.Tuple.Only (Only)++-- 1++type instance Cons a () = Only a+type instance Head (Only a) = a+type instance Tail (Only a) = ()+type instance Init (Only a) = ()+type instance Last (Only a) = a+type instance Length (Only a) = 1++instance HasHead (Only a)++instance HasTail (Only a)++instance HasInit (Only a)++instance HasLast (Only a)++instance HasCons a ()++instance HasUncons (Only a)++instance HasLength (Only a)++type instance Reverse (Only a) = Only a++instance HasReverse (Only a)++type instance (Only a) !! 0 = a++instance HasAt (Only a) 0++-- 2++type instance Cons a (Only b) = (a, b)+type instance Tail (a, b) = Only b+type instance Init (a, b) = Only a++instance HasTail (a, b)++instance HasInit (a, b)++instance HasCons a (Only b)++instance HasUncons (a, b)
+ test/Data/Tuple/List/IdentitySpec.hs view
@@ -0,0 +1,136 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications#-}+{-# LANGUAGE TypeFamilies #-}++{-# OPTIONS_GHC -fdefer-type-errors -Wno-deferred-type-errors -Wno-redundant-constraints #-}++module Data.Tuple.List.IdentitySpec (spec) where++import Data.Tuple.List+import Data.Tuple.List.Identity ()++import Test.Hspec++import Prelude hiding (head, tail, init, last, length, reverse, (!!))++import Data.Functor.Identity+import Data.Proxy+import Test.ShouldNotTypecheck++spec :: Spec+spec = do+ describe "1-tuple" $ do+ describe "Identity" $ do+ it "head" $ do+ let a = ()+ head (Identity a) `shouldBe` a++ it "tail" $ do+ tail (Identity ()) `shouldBe` ()++ it "init" $ do+ init (Identity ()) `shouldBe` ()++ it "last" $ do+ let a = ()+ last (Identity a) `shouldBe` a++ it "cons" $ do+ let a = ()+ cons a () `shouldBe` Identity a++ it "uncons" $ do+ let a = ()+ uncons (Identity a) `shouldBe` (a, ())++ it "Length" $ do+ let+ target :: Length (Identity Int) ~ 1 => ()+ target = ()+ seq target $ pure () :: IO ()++ it "length" $ do+ length (Identity ()) `shouldBe` (1 :: Int)++ it "Null" $ do+ shouldNotTypecheck $ case Identity () of { Null -> False ; _ -> False }++ describe "Cons'" $ do+ it "construct" $ do+ let a = ()+ (Cons a () :: Identity ()) `shouldBe` Identity a++ it "deconstruct" $ do+ case Identity () of { Cons () () -> True ; _ -> False } `shouldBe` True++ it "reverse" $ do+ let a = ()+ reverse (Identity a) `shouldBe` Identity ()++ it "(!!)" $ do+ let a = ()+ Identity a !! (Proxy :: Proxy 0) `shouldBe` a++ it "at" $ do+ let a = ()+ at @_ @0 (Identity a) `shouldBe` a++ describe "2-tuple" $ do+ describe "Identity" $ do+ it "tail'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ tail' (a, b) `shouldBe` Identity b++ it "init'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ init' (a, b) `shouldBe` Identity a++ it "tail" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ tail (a, b) `shouldBe` Identity b++ it "init" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ init (a, b) `shouldBe` Identity a++ it "cons'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ cons' a (Identity b) `shouldBe` (a, b)++ it "uncons'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ uncons' (a, b) `shouldBe` (a, (Identity b))++ it "uncons" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ uncons (a, b) `shouldBe` (a, (Identity b))++ describe "Cons" $ do+ it "construct" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ Cons a (Identity b) `shouldBe` (a, b)
+ test/Data/Tuple/ListSpec.hs view
@@ -0,0 +1,539 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}++{-# OPTIONS_GHC -fdefer-type-errors -Wno-deferred-type-errors -Wno-redundant-constraints #-}++module Data.Tuple.ListSpec (spec) where++import Data.Tuple.List++import Test.Hspec+import Test.ShouldNotTypecheck++import Prelude hiding (head, tail, init, last, length, reverse, (!!))++import Data.Proxy+import Data.Tuple.Single++spec :: Spec+spec = do+ describe "0-tuple" $ do+ describe "Unit" $ do+ it "head'" $ do+ shouldNotTypecheck (head' () :: ())++ it "tail'" $ do+ shouldNotTypecheck (tail' () :: ())++ it "init'" $ do+ shouldNotTypecheck (init' () :: ())++ it "last'" $ do+ shouldNotTypecheck (last' () :: ())++ it "cons'" $ do+ shouldNotTypecheck (cons' 'a' () :: ())++ it "uncons'" $ do+ shouldNotTypecheck (uncons' () :: ((), ()))++ it "head" $ do+ shouldNotTypecheck $ head ()++ it "tail" $ do+ shouldNotTypecheck $ tail ()++ it "init" $ do+ shouldNotTypecheck $ init ()++ it "last" $ do+ shouldNotTypecheck $ last ()++ it "cons" $ do+ shouldNotTypecheck (cons 'a' () :: ())++ it "uncons" $ do+ shouldNotTypecheck $ uncons ()++ it "Length" $ do+ (Proxy :: Proxy (Length ())) `shouldBe` (Proxy :: Proxy 0)++ it "length" $ do+ length () `shouldBe` (0 :: Int)++ it "Null" $ do+ case () of { Null -> True ; _ -> False } `shouldBe` True++ describe "Cons'" $ do+ it "construct" $ do+ shouldNotTypecheck $ Cons' 'a' ()+ it "deconstruct" $ do+ shouldNotTypecheck $ case () of { Cons' _ _ -> () ; _ -> () }++ describe "Cons" $ do+ it "construct" $ do+ shouldNotTypecheck $ Cons 'a' ()+ it "deconstruct" $ do+ shouldNotTypecheck $ case () of { Cons _ _ -> () ; _ -> () }++ it "reverse'" $ do+ reverse' () `shouldBe` ()++ it "reverse" $ do+ reverse () `shouldBe` ()++ it "(!!!)" $ do+ shouldNotTypecheck (() !!! (Proxy :: Proxy 0) :: ())++ it "at'" $ do+ shouldNotTypecheck $ at' @() @0 @() ()++ it "(!!)" $ do+ shouldNotTypecheck $ () !! (Proxy :: Proxy 0)++ it "at" $ do+ shouldNotTypecheck $ at @() @0 ()++ describe "Proxy" $ do+ it "head'" $ do+ shouldNotTypecheck (head' (Proxy :: Proxy Int) :: ())++ -- When searching for "HasTail'" instance for "Proxy", "HasTail' (Proxy a) ()" is matched.+ -- But it is type error, because of "TypeError" constraint.+ -- However on deferred type error environent this does not throw type error,+ -- becouse the "tail'" implementation of "HasHead' (Proxy a) ()" does not call any "TypeError"'s functions.+ -- it "tail'" $ do+ -- shouldNotTypecheck (tail' (Proxy :: Proxy Int) :: ())++ -- The same to tail'.+ -- it "init'" $ do+ -- shouldNotTypecheck (init' (Proxy :: Proxy Int) :: ())++ it "last'" $ do+ shouldNotTypecheck (last' (Proxy :: Proxy Int) :: ())++ it "cons'" $ do+ let a = 0 :: Int+ shouldNotTypecheck (cons' a (Proxy :: Proxy Int) :: Proxy Int)++ it "uncons'" $ do+ shouldNotTypecheck (uncons' (Proxy :: Proxy Int) :: ((), ()))++ it "head" $ do+ shouldNotTypecheck $ head (Proxy :: Proxy Int)++ it "tail" $ do+ shouldNotTypecheck $ tail (Proxy :: Proxy Int)++ it "init" $ do+ shouldNotTypecheck $ init (Proxy :: Proxy Int)++ it "last" $ do+ shouldNotTypecheck $ last (Proxy :: Proxy Int)++ it "uncons" $ do+ shouldNotTypecheck $ uncons (Proxy :: Proxy Int)++ it "Length" $ do+ (Proxy :: Proxy (Length (Proxy ()))) `shouldBe` (Proxy :: Proxy 0)++ it "length" $ do+ length (Proxy :: Proxy Int) `shouldBe` (0 :: Int)++ it "Null" $ do+ case (Proxy :: Proxy Int) of { Null -> True ; _ -> False } `shouldBe` True++ describe "Cons'" $ do+ it "construct" $ do+ shouldNotTypecheck $ Cons' 'a' ()+ it "deconstruct" $ do+ shouldNotTypecheck $ case (Proxy :: Proxy Int) of { Cons' _ _ -> () ; _ -> () }++ describe "Cons" $ do+ it "construct" $ do+ shouldNotTypecheck $ Cons 'a' ()+ it "deconstruct" $ do+ shouldNotTypecheck $ case (Proxy :: Proxy Int) of { Cons _ _ -> () ; _ -> () }++ it "reverse'" $ do+ reverse' (Proxy :: Proxy Int) `shouldBe` (Proxy :: Proxy Int)++ it "reverse" $ do+ reverse (Proxy :: Proxy Int) `shouldBe` (Proxy :: Proxy Int)++ it "(!!!)" $ do+ shouldNotTypecheck ((Proxy :: Proxy Int) !!! (Proxy :: Proxy 0) :: Int)++ it "at'" $ do+ shouldNotTypecheck $ at' @(Proxy Int) @0 @Int Proxy++ it "(!!)" $ do+ shouldNotTypecheck $ (Proxy :: Proxy Int) !! (Proxy :: Proxy 0)++ it "at" $ do+ shouldNotTypecheck $ at @(Proxy Int) @0 Proxy++ describe "2-tuple" $ do+ describe "Single" $ do+ it "head'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ head' (a, b) `shouldBe` a++ it "tail'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ tail' (a, b)++ it "init'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ init' (a, b)++ it "last'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ last' (a, b) `shouldBe` b++ it "head" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ head (a, b) `shouldBe` a++ it "tail" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ tail (a, b)++ it "init" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ init (a, b)++ it "last" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ last (a, b) `shouldBe` b++ it "cons" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ cons a (Single b)++ it "uncons" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ uncons (a, b)++ it "Length" $ do+ let+ target :: Length (Int, Int) ~ 2 => ()+ target = ()+ seq target $ pure () :: IO ()++ it "length" $ do+ length ((0, 1) :: (Int, Int)) `shouldBe` (2 :: Int)++ it "Null" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ case (a, b) of { Null -> () }++ describe "Cons'" $ do+ it "construct" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ (Cons' a (Single b) :: (Int, Int))++ it "deconstruct" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ case (a, b) of { Cons' _ (Single _) -> () }++ describe "Cons" $ do+ it "construct" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ Cons a (Single b)++ it "deconstruct" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ shouldNotTypecheck $ case (a, b) of { Cons _ (Single _) -> () }++ it "reverse'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ reverse' (a, b) `shouldBe` (b, a)++ it "reverse" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ reverse (a, b) `shouldBe` (b, a)++ it "(!!!)" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ (a, b) !!! (Proxy :: Proxy 0) `shouldBe` a+ (a, b) !!! (Proxy :: Proxy 1) `shouldBe` b++ it "at'" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ at' @_ @0 @_ (a, b) `shouldBe` a+ at' @_ @1 @_ (a, b) `shouldBe` b++ it "(!!)" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ (a, b) !! (Proxy :: Proxy 0) `shouldBe` a+ (a, b) !! (Proxy :: Proxy 1) `shouldBe` b++ it "at" $ do+ let+ a, b :: Int+ a = 0+ b = 1+ at @_ @0 (a, b) `shouldBe` a+ at @_ @1 (a, b) `shouldBe` b++ describe "3-tuple" $ do+ it "head'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ head' (a, b, c) `shouldBe` a++ it "tail'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ tail' (a, b, c) `shouldBe` (b, c)++ it "init'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ init' (a, b, c) `shouldBe` (a, b)++ it "last'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ last' (a, b, c) `shouldBe` c++ it "cons'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ cons' a (b, c) `shouldBe` (a, b, c)++ it "uncons'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ uncons' (a, b, c) `shouldBe` (a, (b, c))++ it "head" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ head (a, b, c) `shouldBe` a++ it "tail" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ tail (a, b, c) `shouldBe` (b, c)++ it "init" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ init (a, b, c) `shouldBe` (a, b)++ it "last" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ last (a, b, c) `shouldBe` c++ it "cons" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ cons a (b, c) `shouldBe` (a, b, c)++ it "uncons" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ uncons (a, b, c) `shouldBe` (a, (b, c))++ it "Length" $ do+ let+ target :: Length (Int, Int, Int) ~ 3 => ()+ target = ()+ seq target $ pure () :: IO ()++ it "length" $ do+ length ((0, 1, 2) :: (Int, Int, Int)) `shouldBe` (3 :: Int)++ it "Null" $ do+ shouldNotTypecheck $ case (0, 1, 2) :: (Int, Int, Int) of { Null -> () }++ describe "Cons'" $ do+ it "construct" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ Cons' a (b, c) `shouldBe` (a, b, c)++ it "deconstruct" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ case (a, b, c) of { Cons' a' (b', c') -> (a, b, c) == (a', b', c') ; _ -> False } `shouldBe` True++ describe "Cons" $ do+ it "construct" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ Cons a (b, c) `shouldBe` (a, b, c)++ it "deconstruct" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ case (a, b, c) of { Cons a' (b', c') -> (a, b, c) == (a', b', c') ; _ -> False } `shouldBe` True++ it "reverse'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ reverse' (a, b, c) `shouldBe` (c, b, a)++ it "reverse" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ reverse (a, b, c) `shouldBe` (c, b, a)++ it "(!!!)" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ (a, b, c) !!! (Proxy :: Proxy 0) `shouldBe` a+ (a, b, c) !!! (Proxy :: Proxy 1) `shouldBe` b+ (a, b, c) !!! (Proxy :: Proxy 2) `shouldBe` c++ it "at'" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ at' @_ @0 @_ (a, b, c) `shouldBe` a+ at' @_ @1 @_ (a, b, c) `shouldBe` b+ at' @_ @2 @_ (a, b, c) `shouldBe` c++ it "(!!)" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ (a, b, c) !! (Proxy :: Proxy 0) `shouldBe` a+ (a, b, c) !! (Proxy :: Proxy 1) `shouldBe` b+ (a, b, c) !! (Proxy :: Proxy 2) `shouldBe` c++ it "at" $ do+ let+ a, b, c :: Int+ a = 0+ b = 1+ c = 2+ at @_ @0 (a, b, c) `shouldBe` a+ at @_ @1 (a, b, c) `shouldBe` b+ at @_ @2 (a, b, c) `shouldBe` c
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}