| Copyright | (c) Edward Kmett and Dan Doel 2012-2014 |
|---|---|
| License | BSD3 |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Ermine.Syntax.Core
Contents
Description
- data Core t a
- = Var a
- | HardCore !HardCore
- | Data [t] !Word64 !Global [Core t a]
- | Prim [t] t !Global [Core t a]
- | App !t !(Core t a) !(Core t a)
- | Lam [t] !(Scope Word64 (Core t) a)
- | Let [Scope Word64 (Core t) a] !(Scope Word64 (Core t) a)
- | Case !(Core t a) (Map Word64 (Match t (Core t) a)) (Maybe (Scope () (Core t) a))
- | Dict { }
- data Match t c a = Match {
- _matchArgs :: [t]
- _matchGlobal :: !Global
- _matchBody :: Scope Word64 c a
- matchArgs :: Lens (Match t c a) (Match t' c a) [t] [t']
- matchGlobal :: Lens' (Match t c a) Global
- matchBody :: Lens (Match t c a) (Match t d b) (Scope Word64 c a) (Scope Word64 d b)
- triverseMatch :: Applicative f => (t -> f t') -> (forall x y. (x -> f y) -> c x -> f (c' y)) -> (a -> f a') -> Match t c a -> f (Match t' c' a')
- class (Variable c, AppHash c, AppDict c, App c, Applicative c, Monad c) => Cored t c | c -> t where
- data JavaLike
- = Method !Bool !Text !Text [Text]
- | Constructor !Text [Text]
- | Value !Bool !Text !Text
- data Foreign
- data HardCore
- class AsId c => AsHardCore c where
- super :: (AsHardCore (c a), AppDict c) => Word64 -> c a -> c a
- slot :: (AsHardCore (c a), AppDict c) => Word64 -> c a -> c a
- lam :: (Cored t m, Eq a) => t -> [a] -> Core t a -> m a
- let_ :: (Cored t m, Eq a) => [(a, Core t a)] -> Core t a -> m a
- dataCon :: Cored t m => [t] -> Word64 -> Global -> m a
- prim :: Cored t m => [t] -> t -> Global -> m a
Core Terms
Core values are the output of the compilation process.
They are terms where the dictionary passing has been made explicit and all of the types have been checked and removed.
Constructors
| Var a | |
| HardCore !HardCore | |
| Data [t] !Word64 !Global [Core t a] | |
| Prim [t] t !Global [Core t a] | |
| App !t !(Core t a) !(Core t a) | |
| Lam [t] !(Scope Word64 (Core t) a) | |
| Let [Scope Word64 (Core t) a] !(Scope Word64 (Core t) a) | |
| Case !(Core t a) (Map Word64 (Match t (Core t) a)) (Maybe (Scope () (Core t) a)) | |
| Dict | |
Instances
| Show2 Core | |
| Eq2 Core | |
| Bitraversable Core | |
| Serial2 Core | |
| Hashable2 Core | |
| Bifunctor Core | |
| Bifoldable Core | |
| AsConvention t => Cored t (Core t) | |
| Monad (Core b) | |
| Functor (Core t) | |
| Applicative (Core b) | |
| Foldable (Core t) | |
| Traversable (Core t) | |
| Show b => Show1 (Core b) | |
| Eq b => Eq1 (Core b) | |
| Hashable a => Hashable1 (Core a) | |
| Serial t => Serial1 (Core t) | |
| AsConvention t => AppDict (Core t) | |
| AsConvention t => AppHash (Core t) | |
| AsConvention b => App (Core b) | |
| Variable (Core b) | |
| (Eq t, Eq a) => Eq (Core t a) | |
| (Show t, Show a) => Show (Core t a) | |
| IsString a => IsString (Core b a) | |
| (Binary t, Binary a) => Binary (Core t a) | |
| (Hashable t, Hashable a) => Hashable (Core t a) | |
| (Serialize t, Serialize a) => Serialize (Core t a) | |
| (Serial t, Serial a) => Serial (Core t a) | |
| AsGlobal (Core t a) | |
| AsId (Core t a) | |
| AsHardCore (Core t a) |
Constructors
| Match | |
Fields
| |
Instances
| Functor c => Functor (Match t c) | |
| Foldable c => Foldable (Match t c) | |
| Traversable c => Traversable (Match t c) | |
| (Hashable t, Monad c, Hashable1 c) => Hashable1 (Match t c) | |
| (Serial t, Serial1 c) => Serial1 (Match t c) | |
| Monad c => BoundBy (Match t c) c | |
| (Eq t, Eq a, Monad c, Eq1 c) => Eq (Match t c a) | |
| (Functor c, Show t, Show a, Show1 c) => Show (Match t c a) | |
| (Serial t, Serial1 c, Binary a) => Binary (Match t c a) | |
| (Monad c, Hashable t, Hashable1 c, Hashable a) => Hashable (Match t c a) | |
| (Serial t, Serial1 c, Serialize a) => Serialize (Match t c a) | |
| (Serial t, Serial1 c, Serial a) => Serial (Match t c a) |
matchGlobal :: Lens' (Match t c a) Global Source
triverseMatch :: Applicative f => (t -> f t') -> (forall x y. (x -> f y) -> c x -> f (c' y)) -> (a -> f a') -> Match t c a -> f (Match t' c' a') Source
class (Variable c, AppHash c, AppDict c, App c, Applicative c, Monad c) => Cored t c | c -> t where Source
Instances of this are things we can both construct from a Core expression,
and perform case analysis upon.
Methods
core :: Core t a -> c a Source
case_ :: c a -> Map Word64 (Match t c a) -> Maybe (Scope () c a) -> c a Source
lambda :: [t] -> Scope Word64 c a -> c a Source
letrec :: [Scope Word64 c a] -> Scope Word64 c a -> c a Source
Instances
| AsConvention t => Cored t (Core t) | |
| Cored t m => Cored t (Scope b m) |
Constructors
| Method !Bool !Text !Text [Text] | Java methods: static, class name, method name, arg class names |
| Constructor !Text [Text] | Java constructors: class name, arg class names |
| Value !Bool !Text !Text | Java values: static, class name, field name |
class AsId c => AsHardCore c where Source
This class describes things that could be HardCore.
Minimal complete definition
Nothing
Methods
_HardCore :: Prism' c HardCore Source
_Lit :: Prism' c Literal Source
_Error :: Prism' c Text Source
_Super :: Prism' c Word64 Source
Instances
| AsHardCore HardCore | |
| AsHardCore (Core t a) | |
| (~) (* -> *) f (Core t) => AsHardCore (Scope b f a) |
super :: (AsHardCore (c a), AppDict c) => Word64 -> c a -> c a Source
ask for the nth the superclass of a given dictionary as a core expression
slot :: (AsHardCore (c a), AppDict c) => Word64 -> c a -> c a Source
ask for the nth slot of a given dictionary as a core expression