Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type family Init (d :: [k]) where ...
- type family Last (d :: [k]) where ...
- type family Snoc (d :: [k]) (a :: k) where ...
- type family Lookup (a :: k) (d :: [(k, *)]) where ...
- type family Index (a :: k) (d :: [(k, *)]) where ...
- unsafeIndex :: forall a d f m. (KnownNat (Index a d), Coercible (f Any) (m d)) => (forall c. f c -> Int -> c) -> m d -> Lookup a d
- unsafeCons :: forall a d b f m. (Coercible (f Any) (m d), Coercible (f Any) (m ('(a, b) ': d))) => (forall c. c -> f c -> f c) -> b -> m d -> m ('(a, b) ': d)
- unsafeSnoc :: forall a d b f m. (Last d ~ '(a, b), Coercible (f Any) (m (Init d)), Coercible (f Any) (m d)) => (forall c. f c -> c -> f c) -> m (Init d) -> b -> m d
- class KnownNat (n :: Nat)
- type family Any :: k0 where ...
- unsafeCoerce :: a -> b
- data Proxy (t :: k) :: forall k. k -> Type = Proxy
Documentation
type family Lookup (a :: k) (d :: [(k, *)]) where ... Source #
Type associated with a
in d
. If the key a
occurs multiple times,
the first one is used.
type family Index (a :: k) (d :: [(k, *)]) where ... Source #
Index of type key a
in association list d
.
unsafeIndex :: forall a d f m. (KnownNat (Index a d), Coercible (f Any) (m d)) => (forall c. f c -> Int -> c) -> m d -> Lookup a d Source #
Helper to define index
functions.
unsafeCons :: forall a d b f m. (Coercible (f Any) (m d), Coercible (f Any) (m ('(a, b) ': d))) => (forall c. c -> f c -> f c) -> b -> m d -> m ('(a, b) ': d) Source #
Helper to define cons
functions.
unsafeSnoc :: forall a d b f m. (Last d ~ '(a, b), Coercible (f Any) (m (Init d)), Coercible (f Any) (m d)) => (forall c. f c -> c -> f c) -> m (Init d) -> b -> m d Source #
Helper to define snoc
functions.
This class gives the integer associated with a type-level natural. There are instances of the class for every concrete literal: 0, 1, 2, etc.
Since: base-4.7.0.0
natSing
type family Any :: k0 where ... #
The type constructor Any
is type to which you can unsafely coerce any
lifted type, and back. More concretely, for a lifted type t
and
value x :: t
, -- unsafeCoerce (unsafeCoerce x :: Any) :: t
is equivalent
to x
.
unsafeCoerce :: a -> b #
data Proxy (t :: k) :: forall k. k -> Type #
Proxy
is a type that holds no data, but has a phantom parameter of
arbitrary type (or even kind). Its use is to provide type information, even
though there is no value available of that type (or it may be too costly to
create one).
Historically,
is a safer alternative to the
Proxy
:: Proxy
a'undefined :: a'
idiom.
>>>
Proxy :: Proxy (Void, Int -> Int)
Proxy
Proxy can even hold types of higher kinds,
>>>
Proxy :: Proxy Either
Proxy
>>>
Proxy :: Proxy Functor
Proxy
>>>
Proxy :: Proxy complicatedStructure
Proxy
Instances
Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Foldable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Defined in Data.Foldable fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
Traversable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Alternative (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
MonadPlus (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Bounded (Proxy t) | Since: base-4.7.0.0 |
Enum (Proxy s) | Since: base-4.7.0.0 |
Eq (Proxy s) | Since: base-4.7.0.0 |
Ord (Proxy s) | Since: base-4.7.0.0 |
Read (Proxy t) | Since: base-4.7.0.0 |
Show (Proxy s) | Since: base-4.7.0.0 |
Ix (Proxy s) | Since: base-4.7.0.0 |
Semigroup (Proxy s) | Since: base-4.9.0.0 |
Monoid (Proxy s) | Since: base-4.7.0.0 |