Copyright | (c) Christian Gram Kalhauge 2017 |
---|---|
License | MIT |
Maintainer | kalhuage@cs.ucla.edu |
Safe Haskell | None |
Language | Haskell2010 |
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)
- toBCAttribute :: (IsAttribute (a Low), ByteCodeStaged a, DevolveM m) => (ByteCodeIndex -> m ByteCodeOffset) -> 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 -> f (Attribute Low) -> (Attribute High -> m a) -> m a
- collect :: forall c m. EvolveM m => [AttributeCollector c] -> (Attribute High -> c -> c) -> Attribute High -> m (Endo c)
- collectBC :: forall c m. EvolveM m => (ByteCodeOffset -> m ByteCodeIndex) -> [ByteCodeAttributeCollector c] -> (Attribute High -> c -> c) -> Attribute High -> m (Endo c)
- data AttributeCollector c = (IsAttribute (a Low), Staged a) => Attr (a High -> c -> c)
- data ByteCodeAttributeCollector c = (IsAttribute (a Low), ByteCodeStaged a) => BCAttr (a High -> c -> 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 #
toBCAttribute :: (IsAttribute (a Low), ByteCodeStaged a, DevolveM m) => (ByteCodeIndex -> m ByteCodeOffset) -> 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
.
Instances
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 -> f (Attribute Low) -> (Attribute High -> m a) -> m a Source #
collect :: forall c m. EvolveM m => [AttributeCollector c] -> (Attribute High -> c -> c) -> Attribute High -> m (Endo c) Source #
collectBC :: forall c m. EvolveM m => (ByteCodeOffset -> m ByteCodeIndex) -> [ByteCodeAttributeCollector c] -> (Attribute High -> c -> c) -> Attribute High -> m (Endo c) Source #
data AttributeCollector c Source #
(IsAttribute (a Low), Staged a) => Attr (a High -> c -> c) |
data ByteCodeAttributeCollector c Source #
(IsAttribute (a Low), ByteCodeStaged a) => BCAttr (a High -> c -> c) |
Create a type dependent on another type b
,
used for accessing the correct attrName
in IsAttribute
.