| Copyright | (c) Christian Gram Kalhauge 2017 |
|---|---|
| License | MIT |
| Maintainer | kalhuage@cs.ucla.edu |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.JVM.Attribute.Base
Contents
Description
Synopsis
- data Attribute r = Attribute {
- aName :: !(Ref Text r)
- aInfo' :: !SizedByteString32
- aInfo :: Attribute r -> ByteString
- toAttribute :: (IsAttribute (a Low), Staged a, DevolveM m) => a High -> m (Attribute Low)
- devolveAttribute :: (IsAttribute (a Low), DevolveM m) => (a High -> m (a Low)) -> a High -> m (Attribute Low)
- fromAttribute' :: IsAttribute a => Attribute r -> Either String a
- toAttribute' :: forall a. IsAttribute a => a -> Attribute High
- class Binary a => IsAttribute a where
- type Attributes b r = Choice (SizedList16 (Attribute r)) (b r) r
- fromAttributes :: (Foldable f, EvolveM m, Monoid a) => AttributeLocation -> (Attribute High -> m a) -> f (Attribute Low) -> m a
- toC :: (EvolveM m, Staged a, IsAttribute (a Low)) => (a High -> c) -> Attribute High -> Maybe (m c)
- toC' :: (EvolveM m, IsAttribute (a Low)) => (a Low -> m (a High)) -> (a High -> c) -> Attribute High -> Maybe (m c)
- collect :: Monad m => c -> Attribute High -> [Attribute High -> Maybe (m c)] -> m c
- newtype Const a b = Const {
- unConst :: a
- firstOne :: [a] -> Maybe a
Documentation
An Attribute, simply contains of a reference to a name and contains info.
Instances
aInfo :: Attribute r -> ByteString Source #
A small helper function to extract the info as a
lazy ByteString.
toAttribute :: (IsAttribute (a Low), Staged a, DevolveM m) => a High -> m (Attribute Low) Source #
devolveAttribute :: (IsAttribute (a Low), DevolveM m) => (a High -> m (a Low)) -> a High -> m (Attribute Low) Source #
fromAttribute' :: IsAttribute a => Attribute r -> Either String a Source #
Generate an attribute in a low stage Low.
toAttribute' :: forall a. IsAttribute a => a -> Attribute High Source #
Helpers
class Binary a => IsAttribute a where Source #
A class-type that describes a data-type a as an Attribute. Most notable
it provides the fromAttribute' method that enables converting an Attribute
to a data-type a.
Minimal complete definition
Methods
attrName :: Const Text a Source #
The name of an attribute. This is used to lookup an attribute.
Instances
| IsAttribute (StackMapTable Low) Source # |
|
Defined in Language.JVM.Attribute.StackMapTable | |
| IsAttribute (Signature Low) Source # | |
| IsAttribute (LineNumberTable Low) Source # |
|
Defined in Language.JVM.Attribute.LineNumberTable | |
| IsAttribute (Exceptions Low) Source # |
|
Defined in Language.JVM.Attribute.Exceptions | |
| IsAttribute (EnclosingMethod Low) Source # |
|
Defined in Language.JVM.Attribute.EnclosingMethod | |
| IsAttribute (ConstantValue Low) Source # |
|
Defined in Language.JVM.Attribute.ConstantValue | |
| IsAttribute (Code Low) Source # |
|
| IsAttribute (BootstrapMethods Low) Source # |
|
Defined in Language.JVM.Attribute.BootstrapMethods | |
| IsAttribute (InnerClasses Low) Source # |
|
Defined in Language.JVM.Attribute.InnerClasses | |
type Attributes b r = Choice (SizedList16 (Attribute r)) (b r) r Source #
A list of attributes and described by the expected values.
fromAttributes :: (Foldable f, EvolveM m, Monoid a) => AttributeLocation -> (Attribute High -> m a) -> f (Attribute Low) -> m a Source #
toC :: (EvolveM m, Staged a, IsAttribute (a Low)) => (a High -> c) -> Attribute High -> Maybe (m c) Source #
toC' :: (EvolveM m, IsAttribute (a Low)) => (a Low -> m (a High)) -> (a High -> c) -> Attribute High -> Maybe (m c) Source #
Create a type dependent on another type b,
used for accessing the correct attrName in IsAttribute.