egison-5.0.0: Programming language with non-linear pattern-matching against non-free data
LicenseMIT
Safe HaskellNone
LanguageGHC2021

Language.Egison.Type.Index

Description

This module defines tensor index types for the Egison type system. Indices can be superscript (contravariant, ~i) or subscript (covariant, _i).

Synopsis

Documentation

data IndexKind Source #

The kind of tensor index

Constructors

Superscript

Contravariant index, written as ~i

Subscript

Covariant index, written as _i

Instances

Instances details
Generic IndexKind Source # 
Instance details

Defined in Language.Egison.Type.Index

Associated Types

type Rep IndexKind 
Instance details

Defined in Language.Egison.Type.Index

type Rep IndexKind = D1 ('MetaData "IndexKind" "Language.Egison.Type.Index" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "Superscript" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Subscript" 'PrefixI 'False) (U1 :: Type -> Type))
Show IndexKind Source # 
Instance details

Defined in Language.Egison.Type.Index

Eq IndexKind Source # 
Instance details

Defined in Language.Egison.Type.Index

Ord IndexKind Source # 
Instance details

Defined in Language.Egison.Type.Index

Hashable IndexKind Source # 
Instance details

Defined in Language.Egison.Type.Index

type Rep IndexKind Source # 
Instance details

Defined in Language.Egison.Type.Index

type Rep IndexKind = D1 ('MetaData "IndexKind" "Language.Egison.Type.Index" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "Superscript" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Subscript" 'PrefixI 'False) (U1 :: Type -> Type))

data Index Source #

A tensor index

Constructors

IndexSym IndexKind String

Named index, e.g., _i, ~j

IndexPlaceholder IndexKind

Placeholder index, e.g., _#, ~#

IndexVar String

Index variable (for type-level computation)

Instances

Instances details
Generic Index Source # 
Instance details

Defined in Language.Egison.Type.Index

Methods

from :: Index -> Rep Index x #

to :: Rep Index x -> Index #

Show Index Source # 
Instance details

Defined in Language.Egison.Type.Index

Methods

showsPrec :: Int -> Index -> ShowS #

show :: Index -> String #

showList :: [Index] -> ShowS #

Eq Index Source # 
Instance details

Defined in Language.Egison.Type.Index

Methods

(==) :: Index -> Index -> Bool #

(/=) :: Index -> Index -> Bool #

Ord Index Source # 
Instance details

Defined in Language.Egison.Type.Index

Methods

compare :: Index -> Index -> Ordering #

(<) :: Index -> Index -> Bool #

(<=) :: Index -> Index -> Bool #

(>) :: Index -> Index -> Bool #

(>=) :: Index -> Index -> Bool #

max :: Index -> Index -> Index #

min :: Index -> Index -> Index #

Hashable Index Source # 
Instance details

Defined in Language.Egison.Type.Index

Methods

hashWithSalt :: Int -> Index -> Int #

hash :: Index -> Int #

type Rep Index Source # 
Instance details

Defined in Language.Egison.Type.Index

type IndexSpec = [Index] Source #

A sequence of indices

newtype IndexTyVar Source #

Index variable for type schemes (type-level)

Constructors

IndexTyVar String 

Instances

Instances details
Generic IndexTyVar Source # 
Instance details

Defined in Language.Egison.Type.Index

Associated Types

type Rep IndexTyVar 
Instance details

Defined in Language.Egison.Type.Index

type Rep IndexTyVar = D1 ('MetaData "IndexTyVar" "Language.Egison.Type.Index" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'True) (C1 ('MetaCons "IndexTyVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))
Show IndexTyVar Source # 
Instance details

Defined in Language.Egison.Type.Index

Eq IndexTyVar Source # 
Instance details

Defined in Language.Egison.Type.Index

Ord IndexTyVar Source # 
Instance details

Defined in Language.Egison.Type.Index

type Rep IndexTyVar Source # 
Instance details

Defined in Language.Egison.Type.Index

type Rep IndexTyVar = D1 ('MetaData "IndexTyVar" "Language.Egison.Type.Index" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'True) (C1 ('MetaCons "IndexTyVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

isSupSubPair :: Index -> Index -> Bool Source #

Check if two indices form a superscript-subscript pair (for contraction) For example, ~i and _i form a pair

isSuperscript :: Index -> Bool Source #

Check if an index is a superscript

isSubscript :: Index -> Bool Source #

Check if an index is a subscript

isPlaceholder :: Index -> Bool Source #

Check if an index is a placeholder

indexSymbol :: Index -> Maybe String Source #

Get the symbol name from an index (if it has one)

flipIndexKind :: IndexKind -> IndexKind Source #

Flip the kind of an index (superscript - subscript)