Elm Exactly

Rule 2s-atexp-longvar

Atomic ExpressionsC⊢atexp⇒τ\jdg{C}{\atexp}{\tau}
C(longvar)=(σ,is)σ≻τC⊢longvar⇒τ\frac{\begin{array}{c}C(\longvar) = (\sigma, \is) \premsep \sigma \succ \tau\end{array}}{\begin{array}{c}\jdg{C}{\longvar}{\tau}\end{array}}
(2)
Read it in its chapter·Permanent address: /standard/rules/s-atexp-longvar

Comments

The instantiation of type schemes allows different occurrences of one longvar\longvar to take different types. The identifier status is not used in this rule, nor in rules (3) and (4); in particular the constructor of a record type alias, of status v\isv, elaborates by rule (3) as any constructor does.

Referred to from

TeX source
\defnrule[r:s-atexp-longvar]
  {C(\longvar) = (\sigma, \is) \premsep \sigma \succ \tau}
  {\jdg{C}{\longvar}{\tau}}

Tests (20)

  • elm / DebugLogLambdaBoundaryTest
    A `case` branch that returns a lambda whose parameter is named `log` can still call `Debug.log` inside that lambda.
  • elm / EmbeddedNothingPolymorphicTest
    `Nothing`, `[]` and `""` pass unchanged through the polymorphic `identity`, the first two then also through a function with a concrete type.
  • elm / ImportResolutionQualifiedImportedFunctionTest
    A call written with the module qualifier, `Basics.negate`, resolves to the imported function even though the module is also imported with `exposing (..)`.
  • elm / LetNumberContainerDualTest
    One unannotated `let`-bound tuple of number literals is used both as Ints and as Floats.
  • elm / LetNumberDualUseTest
    An unannotated let-bound `number` value can be used as an `Int` and as a `Float` in the same expression, because Elm generalizes the type of a `let` binding and each use picks its own type.
  • elm / LetNumberListCaseTest
    A `number` computed by a `case` over a let-bound list can be used both as an `Int` and as a `Float`, because Elm generalizes the type of a `let` binding.
  • elm / MinimalVariableTest
    A top-level variable denotes the value of its definition.
  • elm / NamingErrorAnUnknownVariableTest
    A reference to a variable that is defined nowhere, `undefinedName`, is rejected with a NAMING ERROR.
  • elm / PartialAppCaptureTypesTest
    Tests partial applications that hold a bound `Float`, `Char`, `Bool` or `String` argument and return it when later given the remaining arguments.
  • elm / PolyApplyLambdaTest
    Tests a polymorphic `apply f x = f x` called with an `Int` function, a `String` function and an anonymous lambda.
  • elm / PolyChainCallTest
    Tests a polymorphic function that calls another polymorphic function twice, building a binary tree of two nodes that is then counted.
  • elm / PolyChainDictLikeInsertChained5TimesWithTupleKeysConcreteCallerTest
    Tests a polymorphic `insert` on a list-like dictionary type, called five times in a chain from a function with concrete `( String, Int )` keys and `Int` values.
  • elm / PolyChainFoldlLikeCalled8TimesOverTupleKeyedStructureTest
    Tests a polymorphic fold-like function called eight times in a chain, each with a step function over `( List String, Global )` elements and the previous call's result as the initial value.
  • elm / PolyLetConstTest
    A let-bound polymorphic `const` is used at two different type combinations in the same scope, and each use returns its first argument.
  • elm / PolySpecializeRecursiveTest
    Annotated polymorphic recursive functions, `myLength` and `myMap`, give the right results when called at both `Int` and `String` element types.
  • elm / PolyTailRecReverseTest
    An unannotated, polymorphic, tail-recursive list reverse gives the right result at both `Int` and `String` element types.
  • elm / TooManyArgsTooManyArgumentsToALocalTest
    A top-level `Int` value applied to an argument is rejected with a TOO MANY ARGS error.
  • elm / TypeClassConstraintTest
    Checks functions whose types use the constrained type variables `number`, `comparable` and `appendable`.
  • elm / TypeMismatchDifferentlyNamedComparableVarsTest
    A list of two tuples whose first components are values of different custom types is rejected with a TYPE MISMATCH, where the second components are functions annotated with differently named `comparable` variables.
  • elm / TypeMismatchDifferentlyNamedFlexVarsTest
    A list of two tuples whose first components are values of different custom types is rejected with a TYPE MISMATCH, where the second components are functions annotated with differently named type variables.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:s-atexp-longvar] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.