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

Safe HaskellNone
LanguageHaskell2010

Curly.Core.Types

Contents

Synopsis

Type constructors

data TypeClass s Source #

Constructors

Function 
NamedType Int s 
ClassType Int [Set Int] s 

Instances

HasIdents s s' (TypeClass s) (TypeClass s') Source # 

Methods

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

Serializable Bytes s => Serializable Bytes (TypeClass s) Source # 
Format Bytes s => Format Bytes (TypeClass s) Source # 

Methods

datum :: Parser Bytes (TypeClass s) #

Eq s => Eq (TypeClass s) Source # 

Methods

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

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

Ord s => Ord (TypeClass s) Source # 
Identifier s => Show (TypeClass s) Source # 
Generic (TypeClass s) Source # 

Associated Types

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

Methods

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

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

NFData s => NFData (TypeClass s) Source # 

Methods

rnf :: TypeClass s -> () #

type Rep (TypeClass s) Source # 

data NativeType Source #

Instances

Eq NativeType Source # 
Ord NativeType Source # 
Show NativeType Source # 
Generic NativeType Source # 

Associated Types

type Rep NativeType :: * -> * #

NFData NativeType Source # 

Methods

rnf :: NativeType -> () #

Serializable Bytes NativeType Source # 
Format Bytes NativeType Source # 
type Rep NativeType Source # 
type Rep NativeType = D1 (MetaData "NativeType" "Curly.Core.Types" "curly-core-0.7.2-5Alk9IYXOqrI6xJCLJNJpU" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "NT_RigidType" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) (C1 (MetaCons "NT_Int" PrefixI False) U1)) ((:+:) (C1 (MetaCons "NT_String" PrefixI False) U1) (C1 (MetaCons "NT_Array" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "NT_Unit" PrefixI False) U1) (C1 (MetaCons "NT_File" PrefixI False) U1)) ((:+:) (C1 (MetaCons "NT_Syntax" PrefixI False) U1) (C1 (MetaCons "NT_Expr" PrefixI False) U1))))

data TypeShape s Source #

The shape of a Curly type

Instances

Ord s' => HasIdents s s' (TypeShape s) (TypeShape s') Source # 

Methods

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

Serializable Bytes s => Serializable Bytes (TypeShape s) Source # 
(Format Bytes s, Ord s) => Format Bytes (TypeShape s) Source # 

Methods

datum :: Parser Bytes (TypeShape s) #

Eq s => Eq (TypeShape s) Source # 

Methods

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

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

Ord s => Ord (TypeShape s) Source # 
Identifier s => Show (TypeShape s) Source # 
Generic (TypeShape s) Source # 

Associated Types

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

Methods

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

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

NFData s => NFData (TypeShape s) Source # 

Methods

rnf :: TypeShape s -> () #

Ord s => Semigroup (TypeShape s) Source # 

Methods

(+) :: TypeShape s -> TypeShape s -> TypeShape s #

Ord s => Monoid (TypeShape s) Source # 

Methods

zero :: TypeShape s #

type Rep (TypeShape s) Source # 

Type paths

data TypeIndex s Source #

An index into a type

Constructors

TypeIndex (TypeClass s) Int 

Instances

HasIdents s s' (TypeIndex s) (TypeIndex s') Source # 

Methods

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

Serializable Bytes s => Serializable Bytes (TypeIndex s) Source # 
Format Bytes s => Format Bytes (TypeIndex s) Source # 

Methods

datum :: Parser Bytes (TypeIndex s) #

Eq s => Eq (TypeIndex s) Source # 

Methods

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

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

Ord s => Ord (TypeIndex s) Source # 
Identifier s => Show (TypeIndex s) Source # 
Generic (TypeIndex s) Source # 

Associated Types

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

Methods

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

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

NFData s => NFData (TypeIndex s) Source # 

Methods

rnf :: TypeIndex s -> () #

type Rep (TypeIndex s) Source # 
type Rep (TypeIndex s) = D1 (MetaData "TypeIndex" "Curly.Core.Types" "curly-core-0.7.2-5Alk9IYXOqrI6xJCLJNJpU" False) (C1 (MetaCons "TypeIndex" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (TypeClass s))) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int))))

pattern In :: forall t. TypeIndex t Source #

pattern Out :: forall t. TypeIndex t Source #

data PathRoot Source #

The path of a node inside a type.

A path is comprised of two parts : a canonical path, which uniquely identifies the node within its type graph; and a set of equivalent paths that are shared between all types.

Instances

Eq PathRoot Source # 
Ord PathRoot Source # 
Show PathRoot Source # 
Generic PathRoot Source # 

Associated Types

type Rep PathRoot :: * -> * #

Methods

from :: PathRoot -> Rep PathRoot x #

to :: Rep PathRoot x -> PathRoot #

NFData PathRoot Source # 

Methods

rnf :: PathRoot -> () #

Serializable Bytes PathRoot Source # 
Format Bytes PathRoot Source # 
type Rep PathRoot Source # 

Types

newtype Type s Source #

A Curly type.

A Curly type may be understood as a (possibly infinite) set of constraints over its graph ("the node A must be a function", "the output of B must be an Int", ...).

In that sense, Curly types are monoids by isomorphism with the set monoid (C(a+b)=C(a)+C(b) where C(a) is the constraint set of the type a). This monoid instance is used to perform type inference by unifying constraints on the appropriate types.

Constructors

Type (Equiv (TypeShape s) (TypePath s)) 

Instances

(Ord s, Ord s') => HasIdents s s' (Type s) (Type s') Source # 

Methods

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

(Ord s, Serializable Bytes s) => Serializable Bytes (Type s) Source # 
(Ord s, Format Bytes s) => Format Bytes (Type s) Source # 

Methods

datum :: Parser Bytes (Type s) #

Identifier s => Eq (Type s) Source # 

Methods

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

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

Identifier s => Ord (Type s) Source # 

Methods

compare :: Type s -> Type s -> Ordering #

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

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

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

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

max :: Type s -> Type s -> Type s #

min :: Type s -> Type s -> Type s #

Identifier s => Show (Type s) Source # 

Methods

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

show :: Type s -> String #

showList :: [Type s] -> ShowS #

Generic (Type s) Source # 

Associated Types

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

Methods

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

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

NFData s => NFData (Type s) Source # 

Methods

rnf :: Type s -> () #

Identifier s => Semigroup (Type s) Source # 

Methods

(+) :: Type s -> Type s -> Type s #

Identifier s => Monoid (Type s) Source # 

Methods

zero :: Type s #

Identifier s => Documented (Type s) Source # 
Identifier s => OrderedMap (InstanceMap s a) (s, Type s) a Source # 

Methods

ascList :: Iso' (InstanceMap s a) [((s, Type s), a)] #

nearest :: (Bool, Ordering) -> (s, Type s) -> InstanceMap s a -> Maybe ((s, Type s), a) #

Identifier s => DataMap (InstanceMap s a) (s, Set Int, Type s) a Source # 

Methods

at :: (s, Set Int, Type s) -> Lens' (InstanceMap s a) (Maybe a) #

type Rep (Type s) Source # 
type Rep (Type s) = D1 (MetaData "Type" "Curly.Core.Types" "curly-core-0.7.2-5Alk9IYXOqrI6xJCLJNJpU" True) (C1 (MetaCons "Type" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Equiv (TypeShape s) (TypePath s)))))

builtinType :: forall s. Identifier s => Builtin -> Type s Source #

typeConstraints :: Ord s => Type s -> ([(s, [Set Int])], [(s, [Set Int])]) Source #

mapTypePaths :: Ord s => (TypePath s -> Maybe (TypePath s)) -> Type s -> Type s Source #

traverseTypeShapes :: (Ord s, Monad m) => ([TypePath s] -> TypeShape s -> m (TypeShape s)) -> Type s -> m (Type s) Source #

mapTypeShapes :: Ord s => ([TypePath s] -> TypeShape s -> TypeShape s) -> Type s -> Type s Source #

selectConstraints :: Ord s => (Int -> Maybe Int) -> (Int -> Maybe Int) -> Type s -> Type s Source #

abstractStructTypes :: Ord s => s -> [String] -> [String] -> Type s -> (Type s, Type s) Source #

Create a pair of constructor/destructor types

abstractImplicitType :: Ord s => (s, [Set Int]) -> [String] -> Type s -> Type s Source #

functionFrom :: Ord s => Int -> Type s -> Type s Source #

`functionFrom t` is the type (t -> *)

freezeType :: Ord s => Type s -> Type s Source #

thawType :: Ord s => Type s -> Type s Source #

constraintType :: Ord s => s -> Int -> Type s Source #

Implicit instances

data InstanceMap s a Source #

Instances

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

Methods

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

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

Methods

datum :: Parser Bytes (InstanceMap s a) #

Functor (InstanceMap s) Source # 

Methods

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

Foldable (InstanceMap s) Source # 

Methods

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

Identifier s => Traversable (InstanceMap s) Source # 

Methods

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

(Eq a, Identifier s) => Eq (InstanceMap s a) Source # 

Methods

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

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

(Ord a, Identifier s) => Ord (InstanceMap s a) Source # 

Methods

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

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

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

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

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

max :: InstanceMap s a -> InstanceMap s a -> InstanceMap s a #

min :: InstanceMap s a -> InstanceMap s a -> InstanceMap s a #

Generic (InstanceMap s a) Source # 

Associated Types

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

Methods

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

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

Ord s => Semigroup (InstanceMap s a) Source # 

Methods

(+) :: InstanceMap s a -> InstanceMap s a -> InstanceMap s a #

Ord s => Monoid (InstanceMap s a) Source # 

Methods

zero :: InstanceMap s a #

Identifier s => OrderedMap (InstanceMap s a) (s, Type s) a Source # 

Methods

ascList :: Iso' (InstanceMap s a) [((s, Type s), a)] #

nearest :: (Bool, Ordering) -> (s, Type s) -> InstanceMap s a -> Maybe ((s, Type s), a) #

Identifier s => DataMap (InstanceMap s a) (s, Set Int, Type s) a Source # 

Methods

at :: (s, Set Int, Type s) -> Lens' (InstanceMap s a) (Maybe a) #

type Rep (InstanceMap s a) Source # 
type Rep (InstanceMap s a) = D1 (MetaData "InstanceMap" "Curly.Core.Types" "curly-core-0.7.2-5Alk9IYXOqrI6xJCLJNJpU" True) (C1 (MetaCons "InstanceMap" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map s (Map (Type s) a)))))