\section{|TIA| --- Type-Indexed Aggregates --- ``Type Information Awareness''} The original |TIA| module provides aggregates of type-indexed constructions, somewhat inpired by the heterogeneous list data type |HList| of \cite{Kiselyov-Laemmel-Schupke-2004}. \begin{code} {-# LANGUAGE ScopedTypeVariables, KindSignatures #-} -- Original module requires more: -- {-# LANGUAGE ScopedTypeVariables, KindSignatures, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, TypeSynonymInstances, FunctionalDependencies, UndecidableInstances, Rank2Types, TypeOperators #-} module TIATest where \end{code} \begin{code} data TIACons1 (i :: *) (r :: (* -> *) -> *) (c :: * -> *) = c i ::: r c \end{code} Type-level replication is occasionally useful --- we provide hard-coded factors as demand arises. \begin{code} type TIACons2 t x = TIACons1 t (TIACons1 t x) type TIACons3 t x = TIACons2 t (TIACons1 t x) type TIACons4 t x = TIACons2 t (TIACons2 t x) type TIACons7 t x = TIACons4 t (TIACons3 t x) type TIACons8 t x = TIACons4 t (TIACons4 t x) type TIACons15 t x = TIACons8 t (TIACons7 t x) type TIACons16 t x = TIACons8 t (TIACons8 t x) type TIACons31 t x = TIACons16 t (TIACons15 t x) type TIACons32 t x = TIACons16 t (TIACons16 t x) type TIACons47 t x = TIACons32 t (TIACons15 t x) type TIACons48 t x = TIACons32 t (TIACons16 t x) {- -} \end{code} %}}} Up to 8: real 0m0.375s user 0m0.284s sys 0m0.067s -rw------- 1 kahl users 2176 Sep 14 16:39 Utils/TIATest.o -rw------- 1 kahl users 779 Sep 14 16:39 Utils/TIATest.hi Up to 15: real 0m0.374s user 0m0.290s sys 0m0.065s -rw------- 1 kahl users 2176 Sep 14 16:39 Utils/TIATest.o -rw------- 1 kahl users 883 Sep 14 16:39 Utils/TIATest.hi Up to 16: real 0m0.368s user 0m0.298s sys 0m0.064s -rw------- 1 kahl users 2176 Sep 14 16:40 Utils/TIATest.o -rw------- 1 kahl users 961 Sep 14 16:40 Utils/TIATest.hi Up to 31: real 0m7.386s user 0m7.139s sys 0m0.118s -rw------- 1 kahl users 2176 Sep 14 16:41 Utils/TIATest.o -rw------- 1 kahl users 1065 Sep 14 16:41 Utils/TIATest.hi Up to 32: real 0m18.570s user 0m18.301s sys 0m0.188s -rw------- 1 kahl users 2176 Sep 14 16:42 Utils/TIATest.o -rw------- 1 kahl users 1143 Sep 14 16:42 Utils/TIATest.hi %{{{ EMACS lv % Local Variables: % folded-file: t % fold-internal-margins: 0 % eval: (fold-set-marks "%{{{ " "%}}}") % eval: (fold-whole-buffer) % end: %}}}