Copyright | (c) Artem Chirkin |
---|---|
License | BSD3 |
Maintainer | chirkin@arch.ethz.ch |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype Id a = Id {
- runId :: a
- type Tuple (xs :: [Type]) = TypedList Id xs
- data TypedList (f :: k -> Type) (xs :: [k]) where
- pattern U :: forall (f :: k -> Type) (xs :: [k]). () => xs ~ '[] => TypedList f xs
- pattern (:*) :: forall (f :: k -> Type) (xs :: [k]). () => forall (y :: k) (ys :: [k]). xs ~ (y ': ys) => f y -> TypedList f ys -> TypedList f xs
- pattern (:$) :: forall (xs :: [Type]). () => forall (y :: Type) (ys :: [Type]). xs ~ (y ': ys) => y -> Tuple ys -> Tuple xs
- pattern (:!) :: forall (xs :: [Type]). () => forall (y :: Type) (ys :: [Type]). xs ~ (y ': ys) => y -> Tuple ys -> Tuple xs
- pattern Empty :: forall (f :: k -> Type) (xs :: [k]). () => xs ~ '[] => TypedList f xs
- pattern TypeList :: forall (xs :: [k]). () => RepresentableList xs => TypeList xs
- pattern Cons :: forall (f :: k -> Type) (xs :: [k]). () => forall (y :: k) (ys :: [k]). xs ~ (y ': ys) => f y -> TypedList f ys -> TypedList f xs
- pattern Snoc :: forall (f :: k -> Type) (xs :: [k]). () => forall (sy :: [k]) (y :: k). xs ~ (sy +: y) => TypedList f sy -> f y -> TypedList f xs
- pattern Reverse :: forall (f :: k -> Type) (xs :: [k]). () => forall (sx :: [k]). (xs ~ Reverse sx, sx ~ Reverse xs) => TypedList f sx -> TypedList f xs
- (*$) :: x -> Tuple xs -> Tuple (x :+ xs)
- ($*) :: Tuple xs -> x -> Tuple (xs +: x)
- (*!) :: x -> Tuple xs -> Tuple (x :+ xs)
- (!*) :: Tuple xs -> x -> Tuple (xs +: x)
Documentation
This is an almost complete copy of Identity
by (c) Andy Gill 2001.
Instances
Monad Id Source # | |
Functor Id Source # | |
MonadFix Id Source # | |
Defined in Numeric.Tuple.Strict | |
Applicative Id Source # | |
Foldable Id Source # | |
Defined in Numeric.Tuple.Strict fold :: Monoid m => Id m -> m # foldMap :: Monoid m => (a -> m) -> Id a -> m # foldr :: (a -> b -> b) -> b -> Id a -> b # foldr' :: (a -> b -> b) -> b -> Id a -> b # foldl :: (b -> a -> b) -> b -> Id a -> b # foldl' :: (b -> a -> b) -> b -> Id a -> b # foldr1 :: (a -> a -> a) -> Id a -> a # foldl1 :: (a -> a -> a) -> Id a -> a # elem :: Eq a => a -> Id a -> Bool # maximum :: Ord a => Id a -> a # | |
Traversable Id Source # | |
MonadZip Id Source # | |
(RepresentableList xs, All Bounded xs) => Bounded (Tuple xs) Source # | |
Bounded a => Bounded (Id a) Source # | |
Enum a => Enum (Id a) Source # | |
All Eq xs => Eq (Tuple xs) Source # | |
Eq a => Eq (Id a) Source # | |
Floating a => Floating (Id a) Source # | |
Fractional a => Fractional (Id a) Source # | |
Integral a => Integral (Id a) Source # | |
Data a => Data (Id a) Source # | |
Defined in Numeric.Tuple.Strict gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Id a -> c (Id a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Id a) # dataTypeOf :: Id a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Id a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Id a)) # gmapT :: (forall b. Data b => b -> b) -> Id a -> Id a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Id a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Id a -> r # gmapQ :: (forall d. Data d => d -> u) -> Id a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Id a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Id a -> m (Id a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Id a -> m (Id a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Id a -> m (Id a) # | |
Num a => Num (Id a) Source # | |
(All Eq xs, All Ord xs) => Ord (Tuple xs) Source # | Ord instance of the Tuple implements inverse lexicorgaphic ordering. That is, the last element in the tuple is the most significant one. Note, this will never work on infinite-dimensional tuples! |
Defined in Numeric.Tuple.Strict | |
Ord a => Ord (Id a) Source # | |
(RepresentableList xs, All Read xs) => Read (Tuple xs) Source # | |
Read a => Read (Id a) Source # | |
Real a => Real (Id a) Source # | |
Defined in Numeric.Tuple.Strict toRational :: Id a -> Rational # | |
RealFloat a => RealFloat (Id a) Source # | |
Defined in Numeric.Tuple.Strict floatRadix :: Id a -> Integer # floatDigits :: Id a -> Int # floatRange :: Id a -> (Int, Int) # decodeFloat :: Id a -> (Integer, Int) # encodeFloat :: Integer -> Int -> Id a # significand :: Id a -> Id a # scaleFloat :: Int -> Id a -> Id a # isInfinite :: Id a -> Bool # isDenormalized :: Id a -> Bool # isNegativeZero :: Id a -> Bool # | |
RealFrac a => RealFrac (Id a) Source # | |
All Show xs => Show (Tuple xs) Source # | |
Show a => Show (Id a) Source # | |
Ix a => Ix (Id a) Source # | |
IsString a => IsString (Id a) Source # | |
Defined in Numeric.Tuple.Strict fromString :: String -> Id a # | |
Generic (Id a) Source # | |
All Semigroup xs => Semigroup (Tuple xs) Source # | |
Semigroup a => Semigroup (Id a) Source # | |
(Semigroup (Tuple xs), RepresentableList xs, All Monoid xs) => Monoid (Tuple xs) Source # | |
Monoid a => Monoid (Id a) Source # | |
Storable a => Storable (Id a) Source # | |
Bits a => Bits (Id a) Source # | |
Defined in Numeric.Tuple.Strict (.&.) :: Id a -> Id a -> Id a # (.|.) :: Id a -> Id a -> Id a # complement :: Id a -> Id a # shift :: Id a -> Int -> Id a # rotate :: Id a -> Int -> Id a # setBit :: Id a -> Int -> Id a # clearBit :: Id a -> Int -> Id a # complementBit :: Id a -> Int -> Id a # testBit :: Id a -> Int -> Bool # bitSizeMaybe :: Id a -> Maybe Int # shiftL :: Id a -> Int -> Id a # unsafeShiftL :: Id a -> Int -> Id a # shiftR :: Id a -> Int -> Id a # unsafeShiftR :: Id a -> Int -> Id a # rotateL :: Id a -> Int -> Id a # | |
FiniteBits a => FiniteBits (Id a) Source # | |
Defined in Numeric.Tuple.Strict | |
Generic1 Id Source # | |
type Rep (Id a) Source # | |
Defined in Numeric.Tuple.Strict | |
type Rep1 Id Source # | |
Defined in Numeric.Tuple.Strict |
data TypedList (f :: k -> Type) (xs :: [k]) where Source #
Type-indexed list
pattern U :: forall (f :: k -> Type) (xs :: [k]). () => xs ~ '[] => TypedList f xs | Zero-length type list |
pattern (:*) :: forall (f :: k -> Type) (xs :: [k]). () => forall (y :: k) (ys :: [k]). xs ~ (y ': ys) => f y -> TypedList f ys -> TypedList f xs infixr 5 | Constructing a type-indexed list |
pattern (:$) :: forall (xs :: [Type]). () => forall (y :: Type) (ys :: [Type]). xs ~ (y ': ys) => y -> Tuple ys -> Tuple xs infixr 5 | Constructing a type-indexed list |
pattern (:!) :: forall (xs :: [Type]). () => forall (y :: Type) (ys :: [Type]). xs ~ (y ': ys) => y -> Tuple ys -> Tuple xs infixr 5 | Constructing a type-indexed list |
pattern Empty :: forall (f :: k -> Type) (xs :: [k]). () => xs ~ '[] => TypedList f xs | Zero-length type list; synonym to |
pattern TypeList :: forall (xs :: [k]). () => RepresentableList xs => TypeList xs | Pattern matching against this causes |
pattern Cons :: forall (f :: k -> Type) (xs :: [k]). () => forall (y :: k) (ys :: [k]). xs ~ (y ': ys) => f y -> TypedList f ys -> TypedList f xs | Constructing a type-indexed list in the canonical way |
pattern Snoc :: forall (f :: k -> Type) (xs :: [k]). () => forall (sy :: [k]) (y :: k). xs ~ (sy +: y) => TypedList f sy -> f y -> TypedList f xs | Constructing a type-indexed list from the other end |
pattern Reverse :: forall (f :: k -> Type) (xs :: [k]). () => forall (sx :: [k]). (xs ~ Reverse sx, sx ~ Reverse xs) => TypedList f sx -> TypedList f xs | Reverse a typed list |
Instances
(RepresentableList xs, All Bounded xs) => Bounded (Tuple xs) # | |
(RepresentableList xs, All Bounded xs) => Bounded (Tuple xs) # | |
All Eq xs => Eq (Tuple xs) # | |
All Eq xs => Eq (Tuple xs) # | |
(All Eq xs, All Ord xs) => Ord (Tuple xs) # | Ord instance of the Tuple implements inverse lexicorgaphic ordering. That is, the last element in the tuple is the most significant one. Note, this will never work on infinite-dimensional tuples! |
Defined in Numeric.Tuple.Strict | |
(All Eq xs, All Ord xs) => Ord (Tuple xs) # | Ord instance of the Tuple implements inverse lexicorgaphic ordering. That is, the last element in the tuple is the most significant one. Note, this will never work on infinite-dimensional tuples! |
Defined in Numeric.Tuple.Lazy | |
(RepresentableList xs, All Read xs) => Read (Tuple xs) # | |
(RepresentableList xs, All Read xs) => Read (Tuple xs) # | |
All Show xs => Show (Tuple xs) # | |
All Show xs => Show (Tuple xs) # | |
All Semigroup xs => Semigroup (Tuple xs) # | |
All Semigroup xs => Semigroup (Tuple xs) # | |
(Semigroup (Tuple xs), RepresentableList xs, All Monoid xs) => Monoid (Tuple xs) # | |
(Semigroup (Tuple xs), RepresentableList xs, All Monoid xs) => Monoid (Tuple xs) # | |
Dimensions ds => Bounded (Dims ds) # | |
Dimensions ds => Bounded (Idxs ds) # | |
Dimensions ds => Enum (Idxs ds) # | |
Eq (Dims ds) # | |
Eq (Dims ds) # | |
Eq (Idxs xs) # | |
KnownDim n => Num (Idxs (n ': ([] :: [k]))) # | With this instance we can slightly reduce indexing expressions, e.g. x ! (1 :* 2 :* 4) == x ! (1 :* 2 :* 4 :* U) |
Defined in Numeric.Dimensions.Idxs (+) :: Idxs (n ': []) -> Idxs (n ': []) -> Idxs (n ': []) # (-) :: Idxs (n ': []) -> Idxs (n ': []) -> Idxs (n ': []) # (*) :: Idxs (n ': []) -> Idxs (n ': []) -> Idxs (n ': []) # negate :: Idxs (n ': []) -> Idxs (n ': []) # abs :: Idxs (n ': []) -> Idxs (n ': []) # signum :: Idxs (n ': []) -> Idxs (n ': []) # fromInteger :: Integer -> Idxs (n ': []) # | |
Ord (Dims ds) # | |
Ord (Dims ds) # | |
Ord (Idxs xs) # | Compare indices by their importance in lexicorgaphic order
from the last dimension to the first dimension
(the last dimension is the most significant one) Literally, compare a b = compare (reverse $ listIdxs a) (reverse $ listIdxs b) This is the same sort == sortOn fromEnum |
Show (Dims xs) # | |
Show (Idxs xs) # | |
($*) :: Tuple xs -> x -> Tuple (xs +: x) infixl 5 Source #
Grow a tuple on the right. Note, it traverses an element list inside O(n).