@@ -1,18 +1,3 @@
1−{-# LANGUAGE AllowAmbiguousTypes #-}
2−{-# LANGUAGE ConstraintKinds #-}
3−{-# LANGUAGE DataKinds #-}
4−{-# LANGUAGE FlexibleContexts #-}
5−{-# LANGUAGE FlexibleInstances #-}
6−{-# LANGUAGE FunctionalDependencies #-}
7−{-# LANGUAGE GADTs #-}
8−{-# LANGUAGE PatternSynonyms #-}
9−{-# LANGUAGE PolyKinds #-}
10−{-# LANGUAGE RankNTypes #-}
11−{-# LANGUAGE ScopedTypeVariables #-}
12−{-# LANGUAGE TypeApplications #-}
13−{-# LANGUAGE TypeFamilies #-}
14−{-# LANGUAGE TypeOperators #-}
15−{-# LANGUAGE UndecidableInstances #-}
161{-# OPTIONS_GHC -Wno-incomplete-patterns -Wno-redundant-constraints #-}
172
183module Control.Tuple.Morph
@@ -189,13 +174,11 @@ type family Length (aa :: [k]) :: Nat where
189174-- # Morphing
190175
191176class TupleMorphable t th | t -> th where
192−
193177 unmorph :: t -> HList th
194178
195179 morph :: HList th -> t
196180
197181instance (IsMophableTuple t ~ flag, TupleMorphable' t th flag) => TupleMorphable t th where
198−
199182 unmorph = unmorph' (Proxy @flag)
200183
201184 morph = morph' (Proxy @flag)
@@ -203,19 +186,16 @@ instance (IsMophableTuple t ~ flag, TupleMorphable' t th flag) => TupleMorphable
203186-- ## Implementation
204187
205188class TupleMorphable' t th (flag :: Bool) | t flag -> th where
206−
207189 unmorph' :: Proxy flag -> t -> HList th
208190
209191 morph' :: Proxy flag -> HList th -> t
210192
211193instance TupleMorphable' t '[t] 'False where
212−
213194 unmorph' _ t = t :+ HNil
214195
215196 morph' _ (t :+ HNil) = t
216197
217198instance (GenericTupleMorphable (Rep t) th, Generic t) => TupleMorphable' t th 'True where
218−
219199 unmorph' _ = genericUnmorph . from
220200
221201 morph' _ = to . genericMorph
@@ -223,25 +203,21 @@ instance (GenericTupleMorphable (Rep t) th, Generic t) => TupleMorphable' t th '
223203-- ### Generics
224204
225205class GenericTupleMorphable f th | f -> th where
226−
227206 genericUnmorph :: f p -> HList th
228207
229208 genericMorph :: HList th -> f p
230209
231210instance (GenericTupleMorphable f t) => GenericTupleMorphable (M1 i c f) t where
232−
233211 genericUnmorph = genericUnmorph . unM1
234212
235213 genericMorph = M1 . genericMorph
236214
237215instance (TupleMorphable c t) => GenericTupleMorphable (K1 i c) t where
238−
239216 genericUnmorph = unmorph . unK1
240217
241218 genericMorph = K1 . morph
242219
243220instance GenericTupleMorphable U1 '[] where
244−
245221 genericUnmorph _ = HNil
246222
247223 genericMorph _ = U1
@@ -260,7 +236,6 @@ instance
260236 ) =>
261237 GenericTupleMorphable (f :*: g) c
262238 where
263−
264239 genericUnmorph (a :*: b) = genericUnmorph a ++: genericUnmorph b
265240
266241 genericMorph cc = genericMorph aa :*: genericMorph bb