wiki:Rank2Types

Version 2 (modified by loeh@…, 8 years ago) (diff)

small discussion point regarding the relation of PolymorphicComponents and Rank2Types

Rank 2 Types

See ExtensionDescriptionHowto for information on how to write these extension descriptions. Please add any new extensions to the list of HaskellExtensions.

Brief Explanation

Functions may have polymorphic arguments, described by explicit type signatures, e.g.

runST :: (forall s. ST s a) -> a

A special case of RankNTypes.

References

Pros

In my opinion rank 2 types are a prerequisite for PolymorphicComponents, because in the presence of polymorphic components, the constructors of data types already have rank 2 types. -- Andres

  • simple type inference
  • enables runST and similar devices
  • used in cheap deforestation

Cons