curly-core-0.7.2: The core libraries for the Curly compiler.

Safe HaskellNone
LanguageHaskell2010

Curly.Core.Annotated

Contents

Synopsis

Documentation

Building blocks

data Symbol s Source #

A symbol is either an argument referring to its nth parent, or a builtin

Constructors

Argument Int 
Builtin (Type s) Builtin 

Instances

(Identifier s, Identifier s') => HasIdents s s' (Symbol s) (Symbol s') Source # 

Methods

ff'idents :: FixFold s s' (Symbol s) (Symbol s') Source #

(Serializable Bytes s, Identifier s) => Serializable Bytes (Symbol s) Source # 
(Format Bytes s, Identifier s) => Format Bytes (Symbol s) Source # 

Methods

datum :: Parser Bytes (Symbol s) #

Eq (Symbol s) Source # 

Methods

(==) :: Symbol s -> Symbol s -> Bool #

(/=) :: Symbol s -> Symbol s -> Bool #

Ord (Symbol s) Source # 

Methods

compare :: Symbol s -> Symbol s -> Ordering #

(<) :: Symbol s -> Symbol s -> Bool #

(<=) :: Symbol s -> Symbol s -> Bool #

(>) :: Symbol s -> Symbol s -> Bool #

(>=) :: Symbol s -> Symbol s -> Bool #

max :: Symbol s -> Symbol s -> Symbol s #

min :: Symbol s -> Symbol s -> Symbol s #

Show (Symbol s) Source # 

Methods

showsPrec :: Int -> Symbol s -> ShowS #

show :: Symbol s -> String #

showList :: [Symbol s] -> ShowS #

Generic (Symbol s) Source # 

Associated Types

type Rep (Symbol s) :: * -> * #

Methods

from :: Symbol s -> Rep (Symbol s) x #

to :: Rep (Symbol s) x -> Symbol s #

NFData (Symbol s) Source # 

Methods

rnf :: Symbol s -> () #

Documented (Symbol s) Source # 
Identifier s => Annotated (NameExpr s) s Source # 
Identifier s => Annotated (AnnExpr s) s Source # 
Identifier s => Semantic (AnnExpr s) s (Symbol s) Source # 

Methods

semNode :: Iso' (AnnExpr s) (SemanticT (AnnExpr s) s (Symbol s)) Source #

Identifier s => Semantic (RawNameExpr s) s (s, NameTail s) Source # 
Identifier s => Semantic (NameExpr s) s (s, NameTail s) Source # 

Methods

semNode :: Iso' (NameExpr s) (SemanticT (NameExpr s) s (s, NameTail s)) Source #

type Rep (Symbol s) Source # 

data AnnNode s a Source #

An annotated node

This type is used as a base for all fully-resolved expressions. It helps in caching most of the intermediate steps of compiling, such as knowing which variables are free, what size it is, or its type.

Constructors

AnnNode 

Instances

(Identifier s, Identifier s') => HasIdents s s' (AnnNode s a) (AnnNode s' a) Source # 

Methods

ff'idents :: FixFold s s' (AnnNode s a) (AnnNode s' a) Source #

Functor (AnnNode s) Source # 

Methods

map :: (a -> b) -> AnnNode s a -> AnnNode s b #

Foldable (AnnNode s) Source # 

Methods

fold :: Monoid m => AnnNode s m -> m #

Traversable (AnnNode s) Source # 

Methods

sequence :: Applicative f => AnnNode s (f a) -> f (AnnNode s a) #

Identifier s => Annotated (AnnExpr s) s Source # 
Identifier s => Semantic (AnnExpr s) s (Symbol s) Source # 

Methods

semNode :: Iso' (AnnExpr s) (SemanticT (AnnExpr s) s (Symbol s)) Source #

Eq (AnnNode s a) Source # 

Methods

(==) :: AnnNode s a -> AnnNode s a -> Bool #

(/=) :: AnnNode s a -> AnnNode s a -> Bool #

Ord (AnnNode s a) Source # 

Methods

compare :: AnnNode s a -> AnnNode s a -> Ordering #

(<) :: AnnNode s a -> AnnNode s a -> Bool #

(<=) :: AnnNode s a -> AnnNode s a -> Bool #

(>) :: AnnNode s a -> AnnNode s a -> Bool #

(>=) :: AnnNode s a -> AnnNode s a -> Bool #

max :: AnnNode s a -> AnnNode s a -> AnnNode s a #

min :: AnnNode s a -> AnnNode s a -> AnnNode s a #

Generic (AnnNode s a) Source # 

Associated Types

type Rep (AnnNode s a) :: * -> * #

Methods

from :: AnnNode s a -> Rep (AnnNode s a) x #

to :: Rep (AnnNode s a) x -> AnnNode s a #

(NFData s, NFData a) => NFData (AnnNode s a) Source # 

Methods

rnf :: AnnNode s a -> () #

type Rep (AnnNode s a) Source # 

Annotated expressions

class Identifier s => Annotated e s | e -> s where Source #

The class of annotated expressions, from which some information may be retrieved.

Minimal complete definition

exprIdent, exprMass, exprRefs, exprType, exprStrictness

type AnnExpr s = Free (AnnNode s) (Symbol s) Source #

A fully-resolved, annotated expression

anonymous :: NameExpr s -> AnnExpr s Source #

Remove all naming information from an expression.

Named expressions

data NameNode s a Source #

A partially-resolved expression node

Instances

(Identifier s, Identifier s') => HasIdents s s' (NameNode s a) (NameNode s' a) Source # 

Methods

ff'idents :: FixFold s s' (NameNode s a) (NameNode s' a) Source #

Functor (NameNode s) Source # 

Methods

map :: (a -> b) -> NameNode s a -> NameNode s b #

Foldable (NameNode s) Source # 

Methods

fold :: Monoid m => NameNode s m -> m #

Traversable (NameNode s) Source # 

Methods

sequence :: Applicative f => NameNode s (f a) -> f (NameNode s a) #

Identifier s => Annotated (NameExpr s) s Source # 
Identifier s => Semantic (RawNameExpr s) s (s, NameTail s) Source # 
Identifier s => Semantic (NameExpr s) s (s, NameTail s) Source # 

Methods

semNode :: Iso' (NameExpr s) (SemanticT (NameExpr s) s (s, NameTail s)) Source #

(Eq a, Eq s) => Eq (NameNode s a) Source # 

Methods

(==) :: NameNode s a -> NameNode s a -> Bool #

(/=) :: NameNode s a -> NameNode s a -> Bool #

(Ord a, Ord s) => Ord (NameNode s a) Source # 

Methods

compare :: NameNode s a -> NameNode s a -> Ordering #

(<) :: NameNode s a -> NameNode s a -> Bool #

(<=) :: NameNode s a -> NameNode s a -> Bool #

(>) :: NameNode s a -> NameNode s a -> Bool #

(>=) :: NameNode s a -> NameNode s a -> Bool #

max :: NameNode s a -> NameNode s a -> NameNode s a #

min :: NameNode s a -> NameNode s a -> NameNode s a #

type NameExpr s = NameNode s (NameTail s) Source #

A partially resolved expression. Each level corresponds to a different module.

newtype RawNameExpr s Source #

Constructors

RawNameExpr 

Fields

Instances

type NameTail s = Free (NameNode s) (Symbol s) Source #

i'NameNode :: Iso (NameNode s a) (NameNode t b) (Free (AnnNode s) (s, a)) (Free (AnnNode t) (t, b)) Source #

A NameNode's representation

Useful pre-defined expressions

Expression post-processing

optimize :: forall s. Identifier s => (Builtin -> s) -> NameExpr s -> NameExpr s Source #