jvm-binary-0.0.1: A library for reading Java class-files

Copyright(c) Christian Gram Kalhauge 2017
LicenseMIT
Maintainerkalhuage@cs.ucla.edu
Safe HaskellNone
LanguageHaskell2010

Language.JVM.Attribute

Description

This is the main module for accessing all kinds of Attributes.

Synopsis

Documentation

data Attribute Source #

An Attribute, simply contains of a reference to a name and contains info.

aInfo :: Attribute -> ByteString Source #

A small helper function to extract the info as a lazy ByteString.

aName :: ConstantPool -> Attribute -> Maybe Text Source #

Extracts the name from the attribute, if it exists in the ConstantPool.

class 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

attrName, fromAttribute

Methods

attrName :: Const Text a Source #

The name of the attribute.

fromAttribute :: Attribute -> Either String a Source #

Generate a a from an Attribute.

fromAttribute' :: ConstantPool -> Attribute -> Maybe (Either String a) Source #

type Code = Code Attribute Source #

Code is redefined with Attribute, as it is recursively containing Attribute. This is a small hack to fix it.

data Const a b Source #

Create a type dependent on another type b, used for accessing the correct attrName in IsAttribute.