Headline

The ability of program fragments to operate on elements of several types

Illustration

Consider the type of list append in Language:Haskell:

(++) :: [a] -> [a] -> [a]

This type signature uses a type variable a to express that list append is polymorphic in the element type a. The operation can be applied for as long as the element type of both operand lists for an append are the same. We also speak of parametric polymorphism in this case.

Consider the type of addition in Language:Haskell:

(+) :: Num a => a -> a -> a

This type signature uses a type constraint on the operand type of addition to express that only "suitable" types (i.e., type-class instances of Num) can be used for addition. We also speak of type-class polymorphism or more generally of bounded polymorphism in this case. Languages with subtyping may also use types in a subtyping hierarchy for bounds.


Ralf Lämmel edited this article at Thu, 25 May 2017 23:09:03 +0200
Compare revisions Compare revisions

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.