HOME

TheInfoList



OR:

Template Haskell is an experimental language extension to the
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
programming language implemented in the
Glasgow Haskell Compiler The Glasgow Haskell Compiler (GHC) is an open-source native code compiler for the functional programming language Haskell. It provides a cross-platform environment for the writing and testing of Haskell code and it supports numerous extensions, ...
(version 6 and later). In early incarnations it was also known as Template Meta-Haskell. It allows compile-time
metaprogramming Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
and
generative programming In computer science, the term automatic programming identifies a type of computer programming in which some mechanism generates a computer program to allow human programmers to write the code at a higher abstraction level. There has been little ...
by means of manipulating
abstract syntax tree In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text (often source code) written in a formal language. Each node of the tree denotes a construct occurring ...
s and ' splicing' results back into a program. The abstract syntax is represented using ordinary Haskell
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s and the manipulations are performed using ordinary Haskell
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
s. ' Quasi-quote' brackets regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming>
and , /code> are used to get the abstract syntax tree for the enclosed expression and 'splice' brackets $( and ) are used to convert from abstract syntax tree into code. As of GHC-6.10, Template Haskell provides support for user-defined quasi-quoters, which allows users to write parsers which can generate Haskell code from an arbitrary syntax. This syntax is also enforced at compile time. For example, using a custom quasi-quoter for
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
could look like this: digitsFollowedByLetters = \d+ \s+ ,


Example

A common idiom is to quasi-quote an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
, perform some transformation on the expression and splice the result back into the program. It could be written as: result = $( transform input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming> input , )


References

{{reflist


External links


Template Haskell Wiki Page
Experimental programming languages Haskell programming language family Functional languages Metaprogramming