Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Derive.ValType

Description

Type descriptions of the Val.

This is in its own module so Derive.Deriver.Monad can import it without importing Derive.Typecheck.

Synopsis

Documentation

data Type Source #

Constructors

TVal

This is the "any" type.

TSignal NumType NumValue 
TPSignal 
TAttributes 
TControlRef 
TPControlRef 
TPitch 
TNotePitch 
TStr (Maybe [Text])

Text string, with enum values if it's an enum.

TControl 
TPControl 
TNotGiven 
TSeparator 
TMaybe Type 
TEither Type Type 
TPair Type Type

Two types in sequence. This has no corresponding Typecheck instance since it doesn't correspond to a single Val, but is used by Derive.Sig for documentation.

TQuoted

A VQuoted. This has no Typecheck instance so it should never show up as a call argument.

TCFunction 
TPFunction 
TList Type 
TDeriver Text 
TOther Text

Typecheck instances that don't correspond directly to a Val type get this, as a plain description.

Instances

Instances details
Semigroup Type Source #

Get the intersection of the types. If there's no intersection, it winds up at TVal. This is for infer_type_of

Instance details

Defined in Derive.ValType

Methods

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

sconcat :: NonEmpty Type -> Type #

stimes :: Integral b => b -> Type -> Type #

Show Type Source # 
Instance details

Defined in Derive.ValType

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Eq Type Source # 
Instance details

Defined in Derive.ValType

Methods

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

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

Ord Type Source # 
Instance details

Defined in Derive.ValType

Methods

compare :: Type -> Type -> Ordering #

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

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

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

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

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Pretty Type Source # 
Instance details

Defined in Derive.ValType

data NumType Source #

Some of these are subtypes of others (TTranspose includes TDefaultDiatonic), but since they're just documentation, it shouldn't matter.

Instances

Instances details
Semigroup NumType Source # 
Instance details

Defined in Derive.ValType

Show NumType Source # 
Instance details

Defined in Derive.ValType

Eq NumType Source # 
Instance details

Defined in Derive.ValType

Methods

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

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

Ord NumType Source # 
Instance details

Defined in Derive.ValType

Pretty NumType Source # 
Instance details

Defined in Derive.ValType

data NumValue Source #

Numeric subtypes.

Constructors

TAny 
TNonNegative
=0
TPositive
0
TNormalized

0 <= a <= 1

TNormalizedBipolar
  • 1 <= a <= 1

Instances

Instances details
Semigroup NumValue Source # 
Instance details

Defined in Derive.ValType

Show NumValue Source # 
Instance details

Defined in Derive.ValType

Eq NumValue Source # 
Instance details

Defined in Derive.ValType

Ord NumValue Source # 
Instance details

Defined in Derive.ValType

Pretty NumValue Source # 
Instance details

Defined in Derive.ValType

general_type_of :: Val -> Type Source #

Infer a general type. This is also for type errors, but for env type check errors, which use types_equal, which doesn't check the value.

specific_type_of :: Val -> Type Source #

Infer the most specific type possible, looking at the value inside. This is for documentation (e.g. type error messages) for values.