Copyright © Philip M. Parker, INSEAD. Terms of Use.

TYPE INFERENCE

Specialty Definition: TYPE INFERENCE

DomainDefinition

Computing

Type inference An algorithm for ascribing types to expressions in some language, based on the types of the constants of the language and a set of type inference rules such as f :: A -> B, x :: A --------------------- (App) f x :: B This rule, called "App" for application, says that if expression f has type A -> B and expression x has type A then we can deduce that expression (f x) has type B. The expressions above the line are the premises and below, the conclusion. An alternative notation often used is: G |- x : A where "|-" is the turnstile symbol (LaTeX \vdash) and G is a type assignment for the free variables of expression x. The above can be read "under assumptions G, expression x has type A". (As in Haskell, we use a double "::" for type declarations and a single ":" for the infix list constructor, cons). Given an expression plus (head l) 1 we can label each subexpression with a type, using type variables X, Y, etc. for unknown types: (plus :: Int -> Int -> Int) (((head :: [a] -> a) (l :: Y)) :: X) (1 :: Int) We then use unification on type variables to match the partial application of plus to its first argument against the App rule, yielding a type (Int -> Int) and a substitution X = Int. Re-using App for the application to the second argument gives an overall type Int and no further substitutions. Similarly, matching App against the application (head l) we get Y = [X]. We already know X = Int so therefore Y = [Int]. This process is used both to infer types for expressions and to check that any types given by the user are consistent. See also generic type variable, principal type. (1995-02-03). Source: The Free On-line Dictionary of Computing.

Source: compiled by the editor from various references; see credits.

Top     

Specialty Definition: Type inference

(From Wikipedia, the free Encyclopedia)

Type inference is a feature predominant in functional programming languages such as Haskell and ML.

Type inference automatically assigns a type signature onto a function if it is not given. In a sense, the type signature is reconstructed from the compiler/interpreter's understanding of the function's subfunctions with well defined type signatures, and thus the input/output type can be ascertained.

For example, let us consider the Haskell function length, and it is defined as:

length [] = 0
length (first:rest) = 1 + length rest

From this, it is evident that the function handles lists as inputs, and the base case of this recursive function returns an integer (Haskell "Int"). So we can reliably construct a type signature
length :: [a] -> a

Since there are no ad-hoc polymorphic subfunctions in the function definition, we can declare the function to be parametric polymorphic.

Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Type inference."

Top     

Crosswords: TYPE INFERENCE

Specialty definitions using "TYPE INFERENCE": Objective CAMLPersistent Functional Languagetype assignment. (references)

Top     

Anagrams: TYPE INFERENCE

Scrabble® Enable2K-Verified Anagrams

Words within the letters "c-e-e-e-e-f-i-n-n-p-r-t-y"

-3 letters: pertinence, pertinency.

-4 letters: epicenter, inference, penitence, renitency.

-5 letters: enceinte, eyepiece, frenetic, incenter, infecter, internee, prentice, pretence, reinfect, retinene, tenpence, terpenic.

Source: compiled by the editor from various references; see credits.

SCRABBLE® is a registered trademark. All intellectual property rights in and to the game are owned in the U.S.A and Canada by Hasbro Inc., and throughout the rest of the world by J.W. Spear & Sons Limited of Maidenhead, Berkshire, England, a subsidiary of Mattel Inc. Mattel and Spear are not affiliated with Hasbro.

Top     

Alternative Orthography: TYPE INFERENCE


Hexadecimal (or equivalents, 770AD-1900s) (references)

54 59 50 45      49 4E 46 45 52 45 4E 43 45

Leonardo da Vinci (1452-1519; backwards) (references)

    

Binary Code (1918-1938, probably earlier) (references)

01010100 01011001 01010000 01000101 00100000 01001001 01001110 01000110 01000101 01010010 01000101 01001110 01000011 01000101

HTML Code (1990) (references)

&#84 &#89 &#80 &#69 &#32 &#73 &#78 &#70 &#69 &#82 &#69 &#78 &#67 &#69

ISO 10646 (1991-1993) (references)

0054 0059 0050 0045      0049 004E 0046 0045 0052 0045 004E 0043 0045

Encryption (beginner's substitution cypher): (references)

545950392434840395239483739

Top     



INDEX

1. Crosswords
2. Anagrams
3. Orthography
4. Bibliography


  

Copyright © Philip M. Parker, INSEAD. Terms of Use.