Safe Haskell | None |
---|---|
Language | Haskell2010 |
Type-level machinery for tag manipulation.
- class Taggable m where
- class (Taggable m, Tag m ~ Just tag) => Tagged m tag | m -> tag where
- type Tags m = MaybeToList (Tag m) ++ ListMapTag (Inners m)
- type Inners m = Inners' (Inner m)
- class UniqueTag a
- type family UniqueTags m :: Constraint
- ensureUniqueTags :: UniqueTags m => m a -> m a
Documentation
The Taggable
class defines the type families to manage tags in monad
transformer stacks. Its kind is restricted to * -> *
to prevent incorrect
instances.
The Tag
type family equals Nothing
for most types, but for tagged
monad transformers it equals Just tag
.
type Inner m :: Maybe (* -> *) Source
The Inner
type family equals Nothing
for most types, but for
monad transformers with inner monad m
it equals Just m
.
Taggable IO | |
Taggable STM | |
Taggable First | |
Taggable Last | |
Taggable Maybe | |
Taggable Identity | |
Taggable ((->) r) | |
Taggable (Either e) | |
Taggable (ST s) | |
Taggable (ST s) | |
Taggable (Proxy *) | |
Taggable (ListT m) | |
Taggable (MaybeT m) | |
Taggable (IdentityT m) | |
Taggable (ContT r m) | |
Taggable (ReaderT r m) | |
Taggable (StateT s m) | |
Taggable (StateT s m) | |
Taggable (ExceptT e m) | |
Taggable (WriterT w m) | |
Taggable (WriterT w m) | |
Taggable (ReaderT tag r m) | |
Taggable (WriterT tag w m) | |
Taggable (StateT tag s m) | |
Taggable (StateT tag s m) | |
Taggable (ExceptT tag e m) |
class (Taggable m, Tag m ~ Just tag) => Tagged m tag | m -> tag where Source
The Tagged
type class establishes a relationship between a tagged
monad transformer and its untagged counterpart.
Nothing
The main purpose of the UniqueTag
class is to provide clear error
messages when the tag uniqueness property is violated. You should never
write instances for it unless you know what you're doing.
type family UniqueTags m :: Constraint Source
The UniqueTags
constraint placed on a type variable representing a
monad transformer stack ensures that every tag in the stack appears
only once.
UniqueTags m = Unique (Tags m) |
ensureUniqueTags :: UniqueTags m => m a -> m a Source
Type-restricted version of id
that adds a UniqueTags
constraint to
the provided monadic value.