Cayenne (programming language)

Cayenne (programming language)

Cayenne is a functional programming language with dependent types.The basic types are functions, products, and sums. Functions and products use dependent types to gain additional power.

There are very few building blocks in the language, but a lot of syntactic sugar to make it more readable. The syntax is largely borrowed from Haskell.

There is no special module system, because with dependent types records (products) are powerful enough to define modules.

The main aim with Cayenne is not to use the types to express specifications (although this can be done), but rather to use the type system to give type to more functions. An example of a function that can be given a type in Cayenne is printf.

PrintfType :: String -> #PrintfType (Nil) = StringPrintfType ('%':('d':cs)) = Int -> PrintfType csPrintfType ('%':('s':cs)) = String -> PrintfType csPrintfType ('%':( _ :cs)) = PrintfType csPrintfType ( _ :cs) = PrintfType cs

printf' :: (fmt::String) -> String -> PrintfType fmtprintf' (Nil) out = outprintf' ('%':('d':cs)) out = (i::Int) -> printf' cs (out ++ show i)printf' ('%':('s':cs)) out = (s::String) -> printf' cs (out ++ s)printf' ('%':( c :cs)) out = printf' cs (out ++ c : Nil)printf' (c:cs) out = printf' cs (out ++ c : Nil)

printf :: (fmt::String) -> PrintfType fmtprintf fmt = printf' fmt Nil

The Cayenne implementation is written in Haskell, and it also translates to Haskell.

External links

*The [http://www.dependent-types.org/ Cayenne home page]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Haskell (programming language) — Haskell Paradigm(s) functional, lazy/non strict, modular Appeared in 1990 Designed by Simon Peyton Jones, Lennart Aug …   Wikipedia

  • Cayenne (disambiguation) — Cayenne may refer to:* Apache Cayenne, a Java ORM framework * Cayenne (programming language), a dependently typed functional programming language * Cayenne, the capital of French Guiana * Cayenne pepper * Cayenne (mascot), mascot of the… …   Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Apache Cayenne — Infobox Software name = Apache Cayenne caption = developer = Apache Software Foundation latest release version = 2.0.4 latest release date = release date|2007|10|12 latest preview version = 3.0M4 latest preview date = release date|2008|05|29… …   Wikipedia

  • Haskell — Класс языка: функциональный, ленивый, модульный Тип исполнения: компилируемый, интерпретируемый Появился в: 1990 …   Википедия

  • Lennart Augustsson — is a Swedish computer scientist. He was previously a lecturer at the Computing Science Department at Chalmers University of Technology. His research field is functional programming and implementations of functional languages.Augustsson has worked …   Wikipedia

  • Type system — Type systems Type safety Inferred vs. Manifest Dynamic vs. Static Strong vs. Weak Nominal vs. Structural Dependent typing Duck typing Latent typing Linear typing Uniqueness typing …   Wikipedia

  • Spring Framework — Infobox Software name = Spring Framework caption = developer = [http://www.springsource.com SpringSource] latest release version = 2.5.5 latest release date = release date|2008|06|23 latest preview version = latest preview date = operating system …   Wikipedia

  • Список языков программирования — Списки языков программирования Алфавитный По категориям Хронологический Генеалогический Цель этого алфавитного списка языков программирования состоит в том, чтобы дать полный перечень всех существующих языков программирования, как используемых в… …   Википедия

  • Type inference — Type inference, or implicit typing, refers to the ability to deduce automatically the type of a value in a programming language. It is a feature present in some strongly statically typed languages. It is often characteristic of but not limited to …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”