packages feed

indextype 0.2.2.0 → 0.2.3.0

raw patch · 2 files changed

+18/−6 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.IndexT.Constructor: type IndexC (n :: Nat) (i :: Nat) a = IndexCK Type n i a

Files

indextype.cabal view
@@ -1,5 +1,5 @@ name:                 indextype-version:              0.2.2.0+version:              0.2.3.0 synopsis: A series of type families and constraints for "indexable" types. description:   This package deals with types that can roughly be "indexed" at compile time by an integer.
src/Control/IndexT/Constructor.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE TypeInType #-}  {-| This module provides a way to constrain types to be data constructors, much like@@ -16,7 +17,7 @@ needs more. -} module Control.IndexT.Constructor (-  IndexC,+  IndexC, IndexCK,   -- $getConstructorDocs   GetConstructor1,   GetConstructor2,@@ -26,17 +27,28 @@  import GHC.TypeLits (Nat) import GHC.Exts (Constraint)+import Data.Kind (Type)  {-| > IndexC i n (f a_0 a_1 .. a_(n-1))  the ith (zero based) parameter of the constructor with n parameters, i.e. @a_i@++This however only allows constructors with parameters of type :: @Type@,+not of other kinds (see 'IndexCK') -}-type family IndexC (n :: Nat) (i :: Nat) a+type IndexC (n :: Nat) (i :: Nat) a = IndexCK Type n i a -type instance IndexC 1 0 (_ a) = a-type instance IndexC 2 0 (_ a _) = a-type instance IndexC 2 1 (_ _ a) = a+{-|+> Just like 'IndexC' but has an additional kind parameter+-}+type family IndexCK k (n :: Nat) (i :: Nat) a = (r :: k)++type instance IndexCK k 1 0 (_ (a :: k)) = a+type instance IndexCK k 2 0 (_ (a :: k) _) = a+type instance IndexCK k 2 1 (_ _ (a :: k)) = a++  {- $getConstructorDocs These functions actually get the constructor, Unfortunately these are separate named functions instead