eliminators 0.7 → 0.8
raw patch · 15 files changed
+130/−143 lines, 15 filesdep +singletons-basedep −singletonsdep ~basedep ~template-haskelldep ~th-abstractionPVP ok
version bump matches the API change (PVP)
Dependencies added: singletons-base
Dependencies removed: singletons
Dependency ranges changed: base, template-haskell, th-abstraction, th-desugar
API changes (from Hackage documentation)
- Data.Eliminator: elimOption :: forall (a_amMi :: Type) (p_amMl :: (~>) (Option a_amMi) Type) (s_amMm :: Option a_amMi). Sing s_amMm -> (forall (f0_amMn :: Maybe a_amMi). Sing f0_amMn -> Apply p_amMl ('Option f0_amMn)) -> Apply p_amMl s_amMm
- Data.Eliminator: elimAll :: forall (p_amHI :: (~>) All Type) (s_amHJ :: All). Sing s_amHJ -> (forall (f0_amHK :: Bool). Sing f0_amHK -> Apply p_amHI ('All f0_amHK)) -> Apply p_amHI s_amHJ
+ Data.Eliminator: elimAll :: forall (p_anBc :: (~>) All Type) (s_anBd :: All). Sing s_anBd -> (forall (f0_anBe :: Bool). Sing f0_anBe -> Apply p_anBc ('All f0_anBe)) -> Apply p_anBc s_anBd
- Data.Eliminator: elimAny :: forall (p_amHV :: (~>) Any Type) (s_amHW :: Any). Sing s_amHW -> (forall (f0_amHX :: Bool). Sing f0_amHX -> Apply p_amHV ('Any f0_amHX)) -> Apply p_amHV s_amHW
+ Data.Eliminator: elimAny :: forall (p_anBp :: (~>) Any Type) (s_anBq :: Any). Sing s_anBq -> (forall (f0_anBr :: Bool). Sing f0_anBr -> Apply p_anBp ('Any f0_anBr)) -> Apply p_anBp s_anBq
- Data.Eliminator: elimArg :: forall (a_amI7 :: Type) (b_amI8 :: Type) (p_amIc :: (~>) (Arg a_amI7 b_amI8) Type) (s_amId :: Arg a_amI7 b_amI8). Sing s_amId -> (forall (f0_amIe :: a_amI7). Sing f0_amIe -> forall (f1_amIf :: b_amI8). Sing f1_amIf -> Apply p_amIc ('Arg f0_amIe f1_amIf)) -> Apply p_amIc s_amId
+ Data.Eliminator: elimArg :: forall (a_anBB :: Type) (b_anBC :: Type) (p_anBG :: (~>) (Arg a_anBB b_anBC) Type) (s_anBH :: Arg a_anBB b_anBC). Sing s_anBH -> (forall (f0_anBI :: a_anBB). Sing f0_anBI -> forall (f1_anBJ :: b_anBC). Sing f1_anBJ -> Apply p_anBG ('Arg f0_anBI f1_anBJ)) -> Apply p_anBG s_anBH
- Data.Eliminator: elimBool :: forall (p_amIv :: (~>) Bool Type) (s_amIw :: Bool). Sing s_amIw -> Apply p_amIv 'False -> Apply p_amIv 'True -> Apply p_amIv s_amIw
+ Data.Eliminator: elimBool :: forall (p_anBZ :: (~>) Bool Type) (s_anC0 :: Bool). Sing s_anC0 -> Apply p_anBZ 'False -> Apply p_anBZ 'True -> Apply p_anBZ s_anC0
- Data.Eliminator: elimConst :: forall (a_ajKp :: Type) (k_ajKo :: Type) (b_ajKq :: k_ajKo) (p_amIM :: (~>) (Const a_ajKp b_ajKq) Type) (s_amIN :: Const a_ajKp b_ajKq). Sing s_amIN -> (forall (f0_amIO :: a_ajKp). Sing f0_amIO -> Apply p_amIM ('Const f0_amIO)) -> Apply p_amIM s_amIN
+ Data.Eliminator: elimConst :: forall (a_akez :: Type) (k_akey :: Type) (b_akeA :: k_akey) (p_anCg :: (~>) (Const a_akez b_akeA) Type) (s_anCh :: Const a_akez b_akeA). Sing s_anCh -> (forall (f0_anCi :: a_akez). Sing f0_anCi -> Apply p_anCg ('Const f0_anCi)) -> Apply p_anCg s_anCh
- Data.Eliminator: elimDown :: forall (a_alpG :: Type) (p_amJ2 :: (~>) (Down a_alpG) Type) (s_amJ3 :: Down a_alpG). Sing s_amJ3 -> (forall (f0_amJ4 :: a_alpG). Sing f0_amJ4 -> Apply p_amJ2 ('Down f0_amJ4)) -> Apply p_amJ2 s_amJ3
+ Data.Eliminator: elimDown :: forall (a_amnH :: Type) (p_anCw :: (~>) (Down a_amnH) Type) (s_anCx :: Down a_amnH). Sing s_anCx -> (forall (f0_anCy :: a_amnH). Sing f0_anCy -> Apply p_anCw ('Down f0_anCy)) -> Apply p_anCw s_anCx
- Data.Eliminator: elimDual :: forall (a_amxk :: Type) (p_amJg :: (~>) (Dual a_amxk) Type) (s_amJh :: Dual a_amxk). Sing s_amJh -> (forall (f0_amJi :: a_amxk). Sing f0_amJi -> Apply p_amJg ('Dual f0_amJi)) -> Apply p_amJg s_amJh
+ Data.Eliminator: elimDual :: forall (a_anoi :: Type) (p_anCK :: (~>) (Dual a_anoi) Type) (s_anCL :: Dual a_anoi). Sing s_anCL -> (forall (f0_anCM :: a_anoi). Sing f0_anCM -> Apply p_anCK ('Dual f0_anCM)) -> Apply p_anCK s_anCL
- Data.Eliminator: elimEither :: forall (a_amJt :: Type) (b_amJu :: Type) (p_amJB :: (~>) (Either a_amJt b_amJu) Type) (s_amJC :: Either a_amJt b_amJu). Sing s_amJC -> (forall (f0_amJD :: a_amJt). Sing f0_amJD -> Apply p_amJB ('Left f0_amJD)) -> (forall (f0_amJE :: b_amJu). Sing f0_amJE -> Apply p_amJB ('Right f0_amJE)) -> Apply p_amJB s_amJC
+ Data.Eliminator: elimEither :: forall (a_anCX :: Type) (b_anCY :: Type) (p_anD5 :: (~>) (Either a_anCX b_anCY) Type) (s_anD6 :: Either a_anCX b_anCY). Sing s_anD6 -> (forall (f0_anD7 :: a_anCX). Sing f0_anD7 -> Apply p_anD5 ('Left f0_anD7)) -> (forall (f0_anD8 :: b_anCY). Sing f0_anD8 -> Apply p_anD5 ('Right f0_anD8)) -> Apply p_anD5 s_anD6
- Data.Eliminator: elimFirst :: forall (a_amK3 :: Type) (p_amK6 :: (~>) (First a_amK3) Type) (s_amK7 :: First a_amK3). Sing s_amK7 -> (forall (f0_amK8 :: a_amK3). Sing f0_amK8 -> Apply p_amK6 ('First f0_amK8)) -> Apply p_amK6 s_amK7
+ Data.Eliminator: elimFirst :: forall (a_anDx :: Type) (p_anDA :: (~>) (First a_anDx) Type) (s_anDB :: First a_anDx). Sing s_anDB -> (forall (f0_anDC :: a_anDx). Sing f0_anDC -> Apply p_anDA ('First f0_anDC)) -> Apply p_anDA s_anDB
- Data.Eliminator: elimIdentity :: forall (a_alrw :: Type) (p_amKk :: (~>) (Identity a_alrw) Type) (s_amKl :: Identity a_alrw). Sing s_amKl -> (forall (f0_amKm :: a_alrw). Sing f0_amKm -> Apply p_amKk ('Identity f0_amKm)) -> Apply p_amKk s_amKl
+ Data.Eliminator: elimIdentity :: forall (a_alcl :: Type) (p_anDO :: (~>) (Identity a_alcl) Type) (s_anDP :: Identity a_alcl). Sing s_anDP -> (forall (f0_anDQ :: a_alcl). Sing f0_anDQ -> Apply p_anDO ('Identity f0_anDQ)) -> Apply p_anDO s_anDP
- Data.Eliminator: elimLast :: forall (a_amKx :: Type) (p_amKA :: (~>) (Last a_amKx) Type) (s_amKB :: Last a_amKx). Sing s_amKB -> (forall (f0_amKC :: a_amKx). Sing f0_amKC -> Apply p_amKA ('Last f0_amKC)) -> Apply p_amKA s_amKB
+ Data.Eliminator: elimLast :: forall (a_anE1 :: Type) (p_anE4 :: (~>) (Last a_anE1) Type) (s_anE5 :: Last a_anE1). Sing s_anE5 -> (forall (f0_anE6 :: a_anE1). Sing f0_anE6 -> Apply p_anE4 ('Last f0_anE6)) -> Apply p_anE4 s_anE5
- Data.Eliminator: elimList :: forall (a_11 :: Type) (p_anZU :: (~>) ([] a_11) Type) (s_anZV :: [] a_11). Sing s_anZV -> Apply p_anZU '[] -> (forall (f0_anZW :: a_11). Sing f0_anZW -> forall (f1_anZX :: [a_11]). Sing f1_anZX -> Apply p_anZU f1_anZX -> Apply p_anZU ('(:) f0_anZW f1_anZX)) -> Apply p_anZU s_anZV
+ Data.Eliminator: elimList :: forall (a_11 :: Type) (p_aoYU :: (~>) ([] a_11) Type) (s_aoYV :: [] a_11). Sing s_aoYV -> Apply p_aoYU '[] -> (forall (f0_aoYW :: a_11). Sing f0_aoYW -> forall (f1_aoYX :: [a_11]). Sing f1_aoYX -> Apply p_aoYU f1_aoYX -> Apply p_aoYU ('(:) f0_aoYW f1_aoYX)) -> Apply p_aoYU s_aoYV
- Data.Eliminator: elimMax :: forall (a_amKN :: Type) (p_amKQ :: (~>) (Max a_amKN) Type) (s_amKR :: Max a_amKN). Sing s_amKR -> (forall (f0_amKS :: a_amKN). Sing f0_amKS -> Apply p_amKQ ('Max f0_amKS)) -> Apply p_amKQ s_amKR
+ Data.Eliminator: elimMax :: forall (a_anEh :: Type) (p_anEk :: (~>) (Max a_anEh) Type) (s_anEl :: Max a_anEh). Sing s_anEl -> (forall (f0_anEm :: a_anEh). Sing f0_anEm -> Apply p_anEk ('Max f0_anEm)) -> Apply p_anEk s_anEl
- Data.Eliminator: elimMaybe :: forall (a_11 :: Type) (p_amL5 :: (~>) (Maybe a_11) Type) (s_amL6 :: Maybe a_11). Sing s_amL6 -> Apply p_amL5 'Nothing -> (forall (f0_amL7 :: a_11). Sing f0_amL7 -> Apply p_amL5 ('Just f0_amL7)) -> Apply p_amL5 s_amL6
+ Data.Eliminator: elimMaybe :: forall (a_11 :: Type) (p_anEz :: (~>) (Maybe a_11) Type) (s_anEA :: Maybe a_11). Sing s_anEA -> Apply p_anEz 'Nothing -> (forall (f0_anEB :: a_11). Sing f0_anEB -> Apply p_anEz ('Just f0_anEB)) -> Apply p_anEz s_anEA
- Data.Eliminator: elimMin :: forall (a_amLq :: Type) (p_amLt :: (~>) (Min a_amLq) Type) (s_amLu :: Min a_amLq). Sing s_amLu -> (forall (f0_amLv :: a_amLq). Sing f0_amLv -> Apply p_amLt ('Min f0_amLv)) -> Apply p_amLt s_amLu
+ Data.Eliminator: elimMin :: forall (a_anEU :: Type) (p_anEX :: (~>) (Min a_anEU) Type) (s_anEY :: Min a_anEU). Sing s_anEY -> (forall (f0_anEZ :: a_anEU). Sing f0_anEZ -> Apply p_anEX ('Min f0_anEZ)) -> Apply p_anEX s_anEY
- Data.Eliminator: elimNat :: forall (p_amLG :: (~>) Nat Type) (s_amLH :: Nat). Sing s_amLH -> Apply p_amLG 'Z -> (forall (f0_amLI :: Nat). Sing f0_amLI -> Apply p_amLG f0_amLI -> Apply p_amLG ('S f0_amLI)) -> Apply p_amLG s_amLH
+ Data.Eliminator: elimNat :: forall (p_anFa :: (~>) Nat Type) (s_anFb :: Nat). Sing s_anFb -> Apply p_anFa 'Z -> (forall (f0_anFc :: Nat). Sing f0_anFc -> Apply p_anFa f0_anFc -> Apply p_anFa ('S f0_anFc)) -> Apply p_anFa s_anFb
- Data.Eliminator: elimNonEmpty :: forall (a_aeFb :: Type) (p_amM0 :: (~>) (NonEmpty a_aeFb) Type) (s_amM1 :: NonEmpty a_aeFb). Sing s_amM1 -> (forall (f0_amM2 :: a_aeFb). Sing f0_amM2 -> forall (f1_amM3 :: [a_aeFb]). Sing f1_amM3 -> Apply p_amM0 ('(:|) f0_amM2 f1_amM3)) -> Apply p_amM0 s_amM1
+ Data.Eliminator: elimNonEmpty :: forall (a_aeW2 :: Type) (p_anFu :: (~>) (NonEmpty a_aeW2) Type) (s_anFv :: NonEmpty a_aeW2). Sing s_anFv -> (forall (f0_anFw :: a_aeW2). Sing f0_anFw -> forall (f1_anFx :: [a_aeW2]). Sing f1_anFx -> Apply p_anFu ('(:|) f0_anFw f1_anFx)) -> Apply p_anFu s_anFv
- Data.Eliminator: elimOrdering :: forall (p_amMy :: (~>) Ordering Type) (s_amMz :: Ordering). Sing s_amMz -> Apply p_amMy 'LT -> Apply p_amMy 'EQ -> Apply p_amMy 'GT -> Apply p_amMy s_amMz
+ Data.Eliminator: elimOrdering :: forall (p_anFM :: (~>) Ordering Type) (s_anFN :: Ordering). Sing s_anFN -> Apply p_anFM 'LT -> Apply p_anFM 'EQ -> Apply p_anFM 'GT -> Apply p_anFM s_anFN
- Data.Eliminator: elimProduct :: forall (a_amyy :: Type) (p_amMY :: (~>) (Product a_amyy) Type) (s_amMZ :: Product a_amyy). Sing s_amMZ -> (forall (f0_amN0 :: a_amyy). Sing f0_amN0 -> Apply p_amMY ('Product f0_amN0)) -> Apply p_amMY s_amMZ
+ Data.Eliminator: elimProduct :: forall (a_anpw :: Type) (p_anGc :: (~>) (Product a_anpw) Type) (s_anGd :: Product a_anpw). Sing s_anGd -> (forall (f0_anGe :: a_anpw). Sing f0_anGe -> Apply p_anGc ('Product f0_anGe)) -> Apply p_anGc s_anGd
- Data.Eliminator: elimSum :: forall (a_amxW :: Type) (p_amNc :: (~>) (Sum a_amxW) Type) (s_amNd :: Sum a_amxW). Sing s_amNd -> (forall (f0_amNe :: a_amxW). Sing f0_amNe -> Apply p_amNc ('Sum f0_amNe)) -> Apply p_amNc s_amNd
+ Data.Eliminator: elimSum :: forall (a_anoU :: Type) (p_anGq :: (~>) (Sum a_anoU) Type) (s_anGr :: Sum a_anoU). Sing s_anGr -> (forall (f0_anGs :: a_anoU). Sing f0_anGs -> Apply p_anGq ('Sum f0_anGs)) -> Apply p_anGq s_anGr
- Data.Eliminator: elimTuple0 :: forall (p_ao7F :: (~>) () Type) (s_ao7G :: ()). Sing s_ao7G -> Apply p_ao7F '() -> Apply p_ao7F s_ao7G
+ Data.Eliminator: elimTuple0 :: forall (p_ap7m :: (~>) () Type) (s_ap7n :: ()). Sing s_ap7n -> Apply p_ap7m '() -> Apply p_ap7m s_ap7n
- Data.Eliminator: elimTuple2 :: forall (a_11 :: Type) (b_12 :: Type) (p_ao7O :: (~>) ((,) a_11 b_12) Type) (s_ao7P :: (,) a_11 b_12). Sing s_ao7P -> (forall (f0_ao7Q :: a_11). Sing f0_ao7Q -> forall (f1_ao7R :: b_12). Sing f1_ao7R -> Apply p_ao7O ('(,) f0_ao7Q f1_ao7R)) -> Apply p_ao7O s_ao7P
+ Data.Eliminator: elimTuple2 :: forall (a_11 :: Type) (b_12 :: Type) (p_ap7v :: (~>) ((,) a_11 b_12) Type) (s_ap7w :: (,) a_11 b_12). Sing s_ap7w -> (forall (f0_ap7x :: a_11). Sing f0_ap7x -> forall (f1_ap7y :: b_12). Sing f1_ap7y -> Apply p_ap7v ('(,) f0_ap7x f1_ap7y)) -> Apply p_ap7v s_ap7w
- Data.Eliminator: elimTuple3 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (p_ao8a :: (~>) ((,,) a_11 b_12 c_13) Type) (s_ao8b :: (,,) a_11 b_12 c_13). Sing s_ao8b -> (forall (f0_ao8c :: a_11). Sing f0_ao8c -> forall (f1_ao8d :: b_12). Sing f1_ao8d -> forall (f2_ao8e :: c_13). Sing f2_ao8e -> Apply p_ao8a ('(,,) f0_ao8c f1_ao8d f2_ao8e)) -> Apply p_ao8a s_ao8b
+ Data.Eliminator: elimTuple3 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (p_ap7R :: (~>) ((,,) a_11 b_12 c_13) Type) (s_ap7S :: (,,) a_11 b_12 c_13). Sing s_ap7S -> (forall (f0_ap7T :: a_11). Sing f0_ap7T -> forall (f1_ap7U :: b_12). Sing f1_ap7U -> forall (f2_ap7V :: c_13). Sing f2_ap7V -> Apply p_ap7R ('(,,) f0_ap7T f1_ap7U f2_ap7V)) -> Apply p_ap7R s_ap7S
- Data.Eliminator: elimTuple4 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (p_ao8D :: (~>) ((,,,) a_11 b_12 c_13 d_14) Type) (s_ao8E :: (,,,) a_11 b_12 c_13 d_14). Sing s_ao8E -> (forall (f0_ao8F :: a_11). Sing f0_ao8F -> forall (f1_ao8G :: b_12). Sing f1_ao8G -> forall (f2_ao8H :: c_13). Sing f2_ao8H -> forall (f3_ao8I :: d_14). Sing f3_ao8I -> Apply p_ao8D ('(,,,) f0_ao8F f1_ao8G f2_ao8H f3_ao8I)) -> Apply p_ao8D s_ao8E
+ Data.Eliminator: elimTuple4 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (p_ap8k :: (~>) ((,,,) a_11 b_12 c_13 d_14) Type) (s_ap8l :: (,,,) a_11 b_12 c_13 d_14). Sing s_ap8l -> (forall (f0_ap8m :: a_11). Sing f0_ap8m -> forall (f1_ap8n :: b_12). Sing f1_ap8n -> forall (f2_ap8o :: c_13). Sing f2_ap8o -> forall (f3_ap8p :: d_14). Sing f3_ap8p -> Apply p_ap8k ('(,,,) f0_ap8m f1_ap8n f2_ap8o f3_ap8p)) -> Apply p_ap8k s_ap8l
- Data.Eliminator: elimTuple5 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (e_15 :: Type) (p_ao9d :: (~>) ((,,,,) a_11 b_12 c_13 d_14 e_15) Type) (s_ao9e :: (,,,,) a_11 b_12 c_13 d_14 e_15). Sing s_ao9e -> (forall (f0_ao9f :: a_11). Sing f0_ao9f -> forall (f1_ao9g :: b_12). Sing f1_ao9g -> forall (f2_ao9h :: c_13). Sing f2_ao9h -> forall (f3_ao9i :: d_14). Sing f3_ao9i -> forall (f4_ao9j :: e_15). Sing f4_ao9j -> Apply p_ao9d ('(,,,,) f0_ao9f f1_ao9g f2_ao9h f3_ao9i f4_ao9j)) -> Apply p_ao9d s_ao9e
+ Data.Eliminator: elimTuple5 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (e_15 :: Type) (p_ap8U :: (~>) ((,,,,) a_11 b_12 c_13 d_14 e_15) Type) (s_ap8V :: (,,,,) a_11 b_12 c_13 d_14 e_15). Sing s_ap8V -> (forall (f0_ap8W :: a_11). Sing f0_ap8W -> forall (f1_ap8X :: b_12). Sing f1_ap8X -> forall (f2_ap8Y :: c_13). Sing f2_ap8Y -> forall (f3_ap8Z :: d_14). Sing f3_ap8Z -> forall (f4_ap90 :: e_15). Sing f4_ap90 -> Apply p_ap8U ('(,,,,) f0_ap8W f1_ap8X f2_ap8Y f3_ap8Z f4_ap90)) -> Apply p_ap8U s_ap8V
- Data.Eliminator: elimTuple6 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (e_15 :: Type) (f_16 :: Type) (p_ao9U :: (~>) ((,,,,,) a_11 b_12 c_13 d_14 e_15 f_16) Type) (s_ao9V :: (,,,,,) a_11 b_12 c_13 d_14 e_15 f_16). Sing s_ao9V -> (forall (f0_ao9W :: a_11). Sing f0_ao9W -> forall (f1_ao9X :: b_12). Sing f1_ao9X -> forall (f2_ao9Y :: c_13). Sing f2_ao9Y -> forall (f3_ao9Z :: d_14). Sing f3_ao9Z -> forall (f4_aoa0 :: e_15). Sing f4_aoa0 -> forall (f5_aoa1 :: f_16). Sing f5_aoa1 -> Apply p_ao9U ('(,,,,,) f0_ao9W f1_ao9X f2_ao9Y f3_ao9Z f4_aoa0 f5_aoa1)) -> Apply p_ao9U s_ao9V
+ Data.Eliminator: elimTuple6 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (e_15 :: Type) (f_16 :: Type) (p_ap9B :: (~>) ((,,,,,) a_11 b_12 c_13 d_14 e_15 f_16) Type) (s_ap9C :: (,,,,,) a_11 b_12 c_13 d_14 e_15 f_16). Sing s_ap9C -> (forall (f0_ap9D :: a_11). Sing f0_ap9D -> forall (f1_ap9E :: b_12). Sing f1_ap9E -> forall (f2_ap9F :: c_13). Sing f2_ap9F -> forall (f3_ap9G :: d_14). Sing f3_ap9G -> forall (f4_ap9H :: e_15). Sing f4_ap9H -> forall (f5_ap9I :: f_16). Sing f5_ap9I -> Apply p_ap9B ('(,,,,,) f0_ap9D f1_ap9E f2_ap9F f3_ap9G f4_ap9H f5_ap9I)) -> Apply p_ap9B s_ap9C
- Data.Eliminator: elimTuple7 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (e_15 :: Type) (f_16 :: Type) (g_17 :: Type) (p_aoaI :: (~>) ((,,,,,,) a_11 b_12 c_13 d_14 e_15 f_16 g_17) Type) (s_aoaJ :: (,,,,,,) a_11 b_12 c_13 d_14 e_15 f_16 g_17). Sing s_aoaJ -> (forall (f0_aoaK :: a_11). Sing f0_aoaK -> forall (f1_aoaL :: b_12). Sing f1_aoaL -> forall (f2_aoaM :: c_13). Sing f2_aoaM -> forall (f3_aoaN :: d_14). Sing f3_aoaN -> forall (f4_aoaO :: e_15). Sing f4_aoaO -> forall (f5_aoaP :: f_16). Sing f5_aoaP -> forall (f6_aoaQ :: g_17). Sing f6_aoaQ -> Apply p_aoaI ('(,,,,,,) f0_aoaK f1_aoaL f2_aoaM f3_aoaN f4_aoaO f5_aoaP f6_aoaQ)) -> Apply p_aoaI s_aoaJ
+ Data.Eliminator: elimTuple7 :: forall (a_11 :: Type) (b_12 :: Type) (c_13 :: Type) (d_14 :: Type) (e_15 :: Type) (f_16 :: Type) (g_17 :: Type) (p_apap :: (~>) ((,,,,,,) a_11 b_12 c_13 d_14 e_15 f_16 g_17) Type) (s_apaq :: (,,,,,,) a_11 b_12 c_13 d_14 e_15 f_16 g_17). Sing s_apaq -> (forall (f0_apar :: a_11). Sing f0_apar -> forall (f1_apas :: b_12). Sing f1_apas -> forall (f2_apat :: c_13). Sing f2_apat -> forall (f3_apau :: d_14). Sing f3_apau -> forall (f4_apav :: e_15). Sing f4_apav -> forall (f5_apaw :: f_16). Sing f5_apaw -> forall (f6_apax :: g_17). Sing f6_apax -> Apply p_apap ('(,,,,,,) f0_apar f1_apas f2_apat f3_apau f4_apav f5_apaw f6_apax)) -> Apply p_apap s_apaq
- Data.Eliminator: elimVoid :: forall (p_amNp :: (~>) Void Type) (s_amNq :: Void). Sing s_amNq -> Apply p_amNp s_amNq
+ Data.Eliminator: elimVoid :: forall (p_anGD :: (~>) Void Type) (s_anGE :: Void). Sing s_anGE -> Apply p_anGD s_anGE
- Data.Eliminator: elimWrappedMonoid :: forall (m_amNu :: Type) (p_amNx :: (~>) (WrappedMonoid m_amNu) Type) (s_amNy :: WrappedMonoid m_amNu). Sing s_amNy -> (forall (f0_amNz :: m_amNu). Sing f0_amNz -> Apply p_amNx ('WrapMonoid f0_amNz)) -> Apply p_amNx s_amNy
+ Data.Eliminator: elimWrappedMonoid :: forall (m_anGI :: Type) (p_anGL :: (~>) (WrappedMonoid m_anGI) Type) (s_anGM :: WrappedMonoid m_anGI). Sing s_anGM -> (forall (f0_anGN :: m_anGI). Sing f0_anGN -> Apply p_anGL ('WrapMonoid f0_anGN)) -> Apply p_anGL s_anGM
- Data.Eliminator: type family ElimWrappedMonoid p_amNE s_amNF p_amNH
+ Data.Eliminator: type family ElimWrappedMonoid p_anGS s_anGT p_anGV
Files
- CHANGELOG.md +5/−0
- README.md +1/−1
- eliminators.cabal +11/−11
- src/Data/Eliminator.hs +9/−11
- src/Data/Eliminator/TH.hs +28/−25
- src/Data/Eliminator/TypeNats.hs +1/−1
- tests/DecideSpec.hs +15/−13
- tests/DecideTypes.hs +2/−1
- tests/EqualityTypes.hs +8/−20
- tests/GADTSpec.hs +23/−27
- tests/ListSpec.hs +7/−7
- tests/ListTypes.hs +2/−2
- tests/MatchabilizeSpec.hs +2/−2
- tests/VecSpec.hs +2/−2
- tests/VecTypes.hs +14/−20
CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.8 [2021.03.12]+* Require `singletons-base-3.0` and GHC 9.0.+* Remove eliminators for `Data.Semigroup.Option`, which is deprecated as of+ `base-4.15.0.0`.+ ## 0.7 [2020.03.25] * Require `singletons-2.7` and GHC 8.10. * Add experimental support for generating type-level eliminators through the
README.md view
@@ -3,7 +3,7 @@ [](http://packdeps.haskellers.com/reverse/eliminators) [][Haskell.org] [][tl;dr Legal: BSD3]-[](https://travis-ci.org/RyanGlScott/eliminators)+[](https://github.com/RyanGlScott/eliminators/actions?query=workflow%3AHaskell-CI) [Hackage: eliminators]: http://hackage.haskell.org/package/eliminators
eliminators.cabal view
@@ -1,5 +1,5 @@ name: eliminators-version: 0.7+version: 0.8 synopsis: Dependently typed elimination functions using singletons description: This library provides eliminators for inductive data types, leveraging the power of the @singletons@ library to allow@@ -16,7 +16,7 @@ build-type: Simple extra-source-files: CHANGELOG.md, README.md cabal-version: >=1.10-tested-with: GHC == 8.10.1+tested-with: GHC == 9.0.1 source-repository head type: git@@ -26,13 +26,13 @@ exposed-modules: Data.Eliminator Data.Eliminator.TH Data.Eliminator.TypeNats- build-depends: base >= 4.14 && < 4.15+ build-depends: base >= 4.15 && < 4.16 , extra >= 1.4.2 && < 1.8- , singletons >= 2.7 && < 2.8+ , singletons-base >= 3.0 && < 3.1 , singleton-nats >= 0.4.2 && < 0.5- , template-haskell >= 2.16 && < 2.17- , th-abstraction >= 0.3 && < 0.4- , th-desugar >= 1.11 && < 1.12+ , template-haskell >= 2.17 && < 2.18+ , th-abstraction >= 0.4 && < 0.5+ , th-desugar >= 1.12 && < 1.13 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors@@ -52,11 +52,11 @@ ListTypes VecTypes VecSpec- build-depends: base >= 4.14 && < 4.15+ build-depends: base >= 4.15 && < 4.16 , eliminators- , hspec >= 2 && < 3- , singletons >= 2.7 && < 2.8- , singleton-nats >= 0.4.2 && < 0.5+ , hspec >= 2 && < 3+ , singletons-base >= 3.0 && < 3.1+ , singleton-nats >= 0.4.2 && < 0.5 build-tool-depends: hspec-discover:hspec-discover hs-source-dirs: tests default-language: Haskell2010
src/Data/Eliminator.hs view
@@ -61,8 +61,6 @@ , ElimNat , elimNonEmpty , ElimNonEmpty- , elimOption- , ElimOption , elimOrdering , ElimOrdering , elimProduct@@ -93,25 +91,26 @@ import Data.Eliminator.TH import Data.Functor.Const (Const(..))+import Data.Functor.Const.Singletons (SConst(..)) import Data.Functor.Identity (Identity(..))+import Data.Functor.Identity.Singletons (SIdentity(..)) import Data.List.NonEmpty (NonEmpty(..))+import Data.List.NonEmpty.Singletons (SNonEmpty(..)) import Data.Monoid hiding (First, Last)+import Data.Monoid.Singletons hiding (SFirst, SLast) import Data.Nat import Data.Ord (Down(..))+import Data.Ord.Singletons (SDown(..)) import Data.Semigroup-import Data.Singletons.Prelude hiding- (All, Any, Const, Last, Min, Max, Product, Sum)-import Data.Singletons.Prelude.Const (SConst(..))-import Data.Singletons.Prelude.Identity (SIdentity(..))-import Data.Singletons.Prelude.List.NonEmpty (SNonEmpty(..))-import Data.Singletons.Prelude.Monoid hiding (SFirst, SLast)-import Data.Singletons.Prelude.Ord (SDown(..))-import Data.Singletons.Prelude.Semigroup+import Data.Semigroup.Singletons import Data.Void (Void) import Language.Haskell.TH (nameBase) import Language.Haskell.TH.Desugar (tupleNameDegree_maybe) +import Prelude.Singletons hiding+ (All, Any, Const, Last, Min, Max, Product, Sum)+ {- $eliminators These eliminators are defined with propositions of kind @\<Datatype\> ~> 'Type'@@@ -145,7 +144,6 @@ , ''Min , ''Nat , ''NonEmpty- , ''Option , ''Ordering , ''Product , ''Sum
src/Data/Eliminator/TH.hs view
@@ -33,13 +33,15 @@ import qualified Data.Kind as Kind (Type) import Data.Maybe import Data.Proxy-import Data.Singletons.Prelude import Data.Singletons.TH.Options import Language.Haskell.TH import Language.Haskell.TH.Datatype+import Language.Haskell.TH.Datatype.TyVarBndr import Language.Haskell.TH.Desugar hiding (NewOrData(..)) +import Prelude.Singletons+ {- $term-conventions 'deriveElim' and 'deriveElimNamed' provide a way to automate the creation of eliminator functions, which are mostly boilerplate. Here is a complete example@@ -288,8 +290,8 @@ singVar <- newName "s" let elimName = mkName funName promDataKind = datatypeType info- predVarBndr = KindedTV predVar (InfixT promDataKind ''(~>) (ConT ''Kind.Type))- singVarBndr = KindedTV singVar promDataKind+ predVarBndr = kindedTV predVar (InfixT promDataKind ''(~>) (ConT ''Kind.Type))+ singVarBndr = kindedTV singVar promDataKind caseTypes <- traverse (caseType prox dataName predVar) cons let returnType = predType predVar (VarT singVar) elimType = elimTypeSig prox dataVarBndrs predVarBndr singVarBndr@@ -330,8 +332,8 @@ caseClause :: Name -- The name of the eliminator function -> Name -- The name of the data type- -> [TyVarBndr] -- The type variables bound by the data type- -> TyVarBndr -- The predicate type variable+ -> [TyVarBndrUnit] -- The type variables bound by the data type+ -> TyVarBndrUnit -- The predicate type variable -> Int -- The index of this constructor (0-indexed) -> Int -- The total number of data constructors -> ConstructorInfo -- The data constructor@@ -375,8 +377,8 @@ caseTySynEqn :: Name -- The name of the eliminator function -> Name -- The name of the data type- -> [TyVarBndr] -- The type variables bound by the data type- -> TyVarBndr -- The predicate type variable+ -> [TyVarBndrUnit] -- The type variables bound by the data type+ -> TyVarBndrUnit -- The predicate type variable -> Int -- The index of this constructor (0-indexed) -> [Type] -- The types of each "case alternative" in the eliminator -- function's type signature@@ -394,7 +396,7 @@ let mkVarName | i == conIndex = pure usedCaseVar | otherwise = newName ("_p" ++ show i)- in liftA2 KindedTV mkVarName (pure caseTy)+ in liftA2 kindedTV mkVarName (pure caseTy) let caseVarNames = map tvName caseVarBndrs prefix = foldAppKindT (ConT elimName) $ map VarT dataVarNames mbInductiveArg singVar varType =@@ -405,7 +407,7 @@ mkArg f (singVar, varType) = foldAppDefunT (f `AppT` VarT singVar) $ maybeToList (mbInductiveArg singVar varType)- bndrs = dataVarBndrs ++ predVarBndr : caseVarBndrs ++ map PlainTV singVars+ bndrs = dataVarBndrs ++ predVarBndr : caseVarBndrs ++ map plainTV singVars lhs = foldAppT prefix $ VarT predVarName : foldAppT (ConT conName) (map VarT singVars) : map VarT caseVarNames@@ -430,13 +432,13 @@ -- Create an eliminator function's type. elimTypeSig :: proxy t- -> [TyVarBndr] -- The type variables bound by the data type- -> TyVarBndr -- The predicate type variable- -> TyVarBndr -- The type variable whose kind is that of the data type itself- -> [Type] -- The types of each "case alternative" in the eliminator- -- function's type signature- -> Type -- The eliminator function's return type- -> Type -- The full type+ -> [TyVarBndrUnit] -- The type variables bound by the data type+ -> TyVarBndrUnit -- The predicate type variable+ -> TyVarBndrUnit -- The type variable whose kind is that of the data type itself+ -> [Type] -- The types of each "case alternative" in the eliminator+ -- function's type signature+ -> Type -- The eliminator function's return type+ -> Type -- The full type -- Take a data constructor's field type and prepend it to a "case -- alternative" in an eliminator function's type signature.@@ -454,9 +456,9 @@ proxy t -> Name -- The name of the eliminator function -> Name -- The name of the data type- -> [TyVarBndr] -- The type variables bound by the data type- -> TyVarBndr -- The predicate type variable- -> TyVarBndr -- The type variable whose kind is that of the data type itself+ -> [TyVarBndrUnit] -- The type variables bound by the data type+ -> TyVarBndrUnit -- The predicate type variable+ -> TyVarBndrUnit -- The type variable whose kind is that of the data type itself -> [Type] -- The types of each "case alternative" in the eliminator -- function's type signature -> [ConstructorInfo] -- The data constructors@@ -466,11 +468,12 @@ elimSigD _ = SigD elimTypeSig _ dataVarBndrs predVarBndr singVarBndr caseTypes returnType =- ForallT (dataVarBndrs ++ [predVarBndr, singVarBndr]) [] $+ ForallT (changeTVFlags SpecifiedSpec $+ dataVarBndrs ++ [predVarBndr, singVarBndr]) [] $ ravel (singType (tvName singVarBndr):caseTypes) returnType prependElimCaseTypeVar _ dataName predVar var varType t =- ForallT [KindedTV var varType] [] $+ ForallT [kindedTVSpecified var varType] [] $ ravel (singType var:maybeToList (mbInductiveType dataName predVar var varType)) t qElimEqns _ elimName dataName dataVarBndrs predVarBndr _singVarBndr _caseTypes cons@@ -488,20 +491,20 @@ elimSigD _ = KiSigD elimTypeSig _ dataVarBndrs predVarBndr singVarBndr caseTypes returnType =- ForallT dataVarBndrs [] $+ ForallT (changeTVFlags SpecifiedSpec dataVarBndrs) [] $ ForallVisT [predVarBndr, singVarBndr] $ ravel caseTypes returnType prependElimCaseTypeVar _ dataName predVar var varType t =- ForallVisT [KindedTV var varType] $+ ForallVisT [kindedTV var varType] $ ravelDefun (maybeToList (mbInductiveType dataName predVar var varType)) t qElimEqns _ elimName dataName dataVarBndrs predVarBndr singVarBndr caseTypes cons = do- caseVarBndrs <- replicateM (length caseTypes) (PlainTV <$> newName "p")+ caseVarBndrs <- replicateM (length caseTypes) (plainTV <$> newName "p") let predVar = tvName predVarBndr singVar = tvName singVarBndr tyFamHead = TypeFamilyHead elimName- (PlainTV predVar:PlainTV singVar:caseVarBndrs)+ (plainTV predVar:plainTV singVar:caseVarBndrs) NoSig Nothing caseEqns <- itraverse (\i -> caseTySynEqn elimName dataName dataVarBndrs predVarBndr i caseTypes) cons
src/Data/Eliminator/TypeNats.hs view
@@ -20,8 +20,8 @@ import Data.Kind (Type) import Data.Singletons-import Data.Singletons.TypeLits +import GHC.TypeLits.Singletons import GHC.TypeNats import Unsafe.Coerce (unsafeCoerce)
tests/DecideSpec.hs view
@@ -11,13 +11,14 @@ import Data.Eliminator import Data.Nat-import Data.Singletons.Prelude import Data.Singletons.TH hiding (Decision(..)) import Data.Type.Equality import EqualitySpec (cong, replace) import DecideTypes +import Prelude.Singletons+ import Test.Hspec main :: IO ()@@ -120,8 +121,8 @@ base :: ListEqConsequences '[] '[] base = () - step :: forall (x :: e) (xs :: [e]).- Sing x -> Sing xs+ step :: forall (x :: e). Sing x+ -> forall (xs :: [e]). Sing xs -> ListEqConsequences xs xs -> ListEqConsequences (x:xs) (x:xs) step _ _ _ = (Refl, Refl)@@ -149,11 +150,11 @@ base :: Decision ('[] :~: '[]) base = Proved Refl - step :: forall (x :: e) (xs :: [e]).- Sing x -> Sing xs+ step :: forall (x :: e). Sing x+ -> forall (xs :: [e]). Sing xs -> Decision ('[] :~: xs) -> Decision ('[] :~: (x:xs))- step _ _ _ = Disproved (nilNotCons @e @x @xs)+ step _ (_ :: Sing xs) _ = Disproved (nilNotCons @e @x @xs) intermixListEqs :: forall e (x :: e) (xs :: [e]) (y :: e) (ys :: [e]). x :~: y -> xs :~: ys@@ -202,19 +203,20 @@ base :: WhyDecEqList '[] base = WhyDecEqList decEqNil - step :: forall (x :: e) (xs :: [e]).- Sing x -> Sing xs+ step :: forall (x :: e). Sing x+ -> forall (xs :: [e]). Sing xs -> WhyDecEqList xs -> WhyDecEqList (x:xs)- step sx sxs swhyXs = WhyDecEqList $ \(sl :: Sing l) ->- elimList @e @(WhyDecEqConsSym2 x xs) @l sl- stepBase stepStep+ step sx (sxs :: Sing xs) swhyXs =+ WhyDecEqList $ \(sl :: Sing l) ->+ elimList @e @(WhyDecEqConsSym2 x xs) @l sl+ stepBase stepStep where stepBase :: Decision ((x:xs) :~: '[]) stepBase = Disproved $ consNotNil @e @x @xs - stepStep :: forall (y :: e) (ys :: [e]).- Sing y -> Sing ys+ stepStep :: forall (y :: e). Sing y+ -> forall (ys :: [e]). Sing ys -> Decision ((x:xs) :~: ys) -> Decision ((x:xs) :~: (y:ys)) stepStep sy sys _ = decCongCons sx sxs
tests/DecideTypes.hs view
@@ -16,8 +16,9 @@ import Data.Eliminator import Data.Kind import Data.Nat-import Data.Singletons.Prelude import Data.Singletons.TH hiding (Decision(..))++import Prelude.Singletons -- Due to https://github.com/goldfirere/singletons/issues/82, promoting the -- Decision data type from Data.Singletons.Decide is a tad awkward. To work
tests/EqualityTypes.hs view
@@ -10,27 +10,28 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -Wno-orphans #-} module EqualityTypes where import Data.Kind import Data.Singletons.TH+import Data.Singletons.TH.Options import Data.Type.Equality ((:~~:)(..)) import Internal -type (%:~:) :: a :~: b -> Type-data (%:~:) e where- SRefl :: (%:~:) Refl-type instance Sing = (%:~:)+$(withOptions defaultOptions{genSingKindInsts = False} $+ genSingletons [''(:~:), ''(:~~:)]) instance SingKind (a :~: b) where type Demote (a :~: b) = a :~: b fromSing SRefl = Refl toSing Refl = SomeSing SRefl -instance SingI Refl where- sing = SRefl+instance SingKind (a :~~: b) where+ type Demote (a :~~: b) = a :~~: b+ fromSing SHRefl = HRefl+ toSing HRefl = SomeSing SHRefl -- | Christine Paulin-Mohring's version of the J rule. (~>:~:) :: forall k (a :: k)@@ -69,19 +70,6 @@ -> p @@ b type family (~>!:~:) p r pRefl where (~>!:~:) _ Refl pRefl = pRefl--type (%:~~:) :: forall j k (a :: j) (b :: k). a :~~: b -> Type-data (%:~~:) e where- SHRefl :: (%:~~:) HRefl-type instance Sing = (%:~~:)--instance SingKind (a :~~: b) where- type Demote (a :~~: b) = a :~~: b- fromSing SHRefl = HRefl- toSing HRefl = SomeSing SHRefl--instance SingI HRefl where- sing = SHRefl -- | Christine Paulin-Mohring's version of the J rule, but heterogeneously kinded. (~>:~~:) :: forall j (a :: j)
tests/GADTSpec.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneKindSignatures #-}+{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -12,7 +13,8 @@ module GADTSpec where import Data.Kind-import Data.Singletons+import Data.Singletons.TH+import Data.Singletons.TH.Options import Internal @@ -26,14 +28,12 @@ ----- -type So :: Bool -> Type-data So b where- Oh :: So True--type SSo :: So what -> Type-data SSo s where- SOh :: SSo Oh-type instance Sing = SSo+$(withOptions defaultOptions{genSingKindInsts = False} $+ singletons [d|+ type So :: Bool -> Type+ data So b where+ Oh :: So True+ |]) elimSo :: forall (p :: forall (long_sucker :: Bool). So long_sucker ~> Type) (what :: Bool) (s :: So what).@@ -67,16 +67,14 @@ forall (p :: Bool ~> Prop) (pOh :: p @@ True). ElimPropSo p Oh pOh = pOh -type Flarble :: Type -> Type -> Type-data Flarble a b where- MkFlarble1 :: a -> Flarble a b- MkFlarble2 :: a ~ Bool => Flarble a (Maybe b)--type SFlarble :: Flarble a b -> Type-data SFlarble f where- SMkFlarble1 :: Sing x -> SFlarble (MkFlarble1 x)- SMkFlarble2 :: SFlarble MkFlarble2-type instance Sing = SFlarble+$(withOptions defaultOptions{genSingKindInsts = False} $+ singletons [d|+ type Flarble :: Type -> Type -> Type+ data Flarble a b where+ MkFlarble1 :: a -> Flarble a b+ -- MkFlarble2 :: a ~ Bool => Flarble a (Maybe b)+ MkFlarble2 :: Flarble Bool (Maybe b)+ |]) elimFlarble :: forall (p :: forall x y. Flarble x y ~> Type) a b (f :: Flarble a b).@@ -141,14 +139,12 @@ ElimPropFlarble p (MkFlarble2 :: Flarble Bool (Maybe b')) pMkFlarble1 pMkFlarble2 = pMkFlarble2 @b' -type Obj :: Type-data Obj where- MkObj :: o -> Obj--type SObj :: Obj -> Type-data SObj o where- SMkObj :: forall obiwan (obj :: obiwan). Sing obj -> SObj (MkObj obj)-type instance Sing = SObj+$(withOptions defaultOptions{genSingKindInsts = False} $+ singletons [d|+ type Obj :: Type+ data Obj where+ MkObj :: o -> Obj+ |]) elimObj :: forall (p :: Obj ~> Type) (o :: Obj). Sing o
tests/ListSpec.hs view
@@ -10,14 +10,14 @@ module ListSpec where import Data.Eliminator-import Data.Singletons.Prelude-import Data.Singletons.Prelude.List+import Data.List.Singletons import Data.Type.Equality import EqualitySpec (cong)- import ListTypes +import Prelude.Singletons+ import Test.Hspec main :: IO ()@@ -37,8 +37,8 @@ base :: WhyMapPreservesLength f '[] base = Refl - step :: forall (s :: x) (ss :: [x]).- Sing s -> Sing ss+ step :: forall (s :: x). Sing s+ -> forall (ss :: [x]). Sing ss -> WhyMapPreservesLength f ss -> WhyMapPreservesLength f (s:ss) step _ _ = cong @_ @_ @((+@#@$$) 1)@@ -53,8 +53,8 @@ base :: WhyMapFusion f g '[] base = Refl - step :: forall (s :: x) (ss :: [x]).- Sing s -> Sing ss+ step :: forall (s :: x). Sing s+ -> forall (ss :: [x]). Sing ss -> WhyMapFusion f g ss -> WhyMapFusion f g (s:ss) step _ _ = cong @_ @_ @((:@#@$$) (f @@ (g @@ s)))
tests/ListTypes.hs view
@@ -9,9 +9,9 @@ module ListTypes where import Data.Kind-import Data.Singletons.Prelude-import Data.Singletons.Prelude.List+import Data.List.Singletons import Data.Singletons.TH+import Prelude.Singletons $(singletons [d| type WhyMapPreservesLength :: (x ~> y) -> [x] -> Type
tests/MatchabilizeSpec.hs view
@@ -7,11 +7,11 @@ module MatchabilizeSpec where import Data.Eliminator-import Data.Singletons-import Data.Singletons.Prelude import Data.Type.Equality import MatchabilizeTypes++import Prelude.Singletons import Test.Hspec
tests/VecSpec.hs view
@@ -9,8 +9,8 @@ import Data.Eliminator import Data.Nat-import Data.Singletons-import Data.Singletons.Prelude.Num++import Prelude.Singletons import VecTypes
tests/VecTypes.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE DataKinds #-}+{-# LANGUAGE EmptyCase #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE NoStarIsType #-} {-# LANGUAGE PolyKinds #-}@@ -16,26 +17,25 @@ import Data.Kind (Type) import Data.Nat-import Data.Singletons.Prelude.Num-import Data.Singletons.TH+import Data.Singletons.Base.TH+import Data.Singletons.TH.Options+ import Internal -type Vec :: Type -> Nat -> Type-data Vec :: Type -> Nat -> Type where- VNil :: Vec a Z- (:#) :: { vhead :: a, vtail :: Vec a n } -> Vec a (S n)-infixr 5 :#+import Prelude.Singletons++$(withOptions defaultOptions{genSingKindInsts = False} $+ singletons [d|+ type Vec :: Type -> Nat -> Type+ data Vec a n where+ VNil :: Vec a Z+ (:#) :: { vhead :: a, vtail :: Vec a n } -> Vec a (S n)+ infixr 5 :#+ |]) deriving instance Eq a => Eq (Vec a n) deriving instance Ord a => Ord (Vec a n) deriving instance Show a => Show (Vec a n) -type SVec :: Vec a n -> Type-data SVec v where- SVNil :: SVec VNil- (:%#) :: { sVhead :: Sing x, sVtail :: Sing xs } -> SVec (x :# xs)-type instance Sing = SVec-infixr 5 :%#- instance SingKind a => SingKind (Vec a n) where type Demote (Vec a n) = Vec (Demote a) n fromSing SVNil = VNil@@ -45,12 +45,6 @@ withSomeSing x $ \sx -> withSomeSing xs $ \sxs -> SomeSing $ sx :%# sxs--instance SingI VNil where- sing = SVNil--instance (SingI x, SingI xs) => SingI (x :# xs) where- sing = sing :%# sing elimVec :: forall a (p :: forall (k :: Nat). Vec a k ~> Type) (n :: Nat) (v :: Vec a n).