Search engine for discovering works of Art, research articles, and books related to Art and Culture
ShareThis
Javascript must be enabled to continue!

Injective type families for Haskell

View through CrossRef
Haskell, as implemented by the Glasgow Haskell Compiler (GHC), allows expressive type-level programming. The most popular type-level programming extension is TypeFamilies, which allows users to write functions on types. Yet, using type functions can cripple type inference in certain situations. In particular, lack of injectivity in type functions means that GHC can never infer an instantiation of a type variable appearing only under type functions. In this paper, we describe a small modification to GHC that allows type functions to be annotated as injective. GHC naturally must check validity of the injectivity annotations. The algorithm to do so is surprisingly subtle. We prove soundness for a simplification of our algorithm, and state and prove a completeness property, though the algorithm is not fully complete. As much of our reasoning surrounds functions defined by a simple pattern-matching structure, we believe our results extend beyond just Haskell. We have implemented our solution on a branch of GHC and plan to make it available to regular users with the next stable release of the compiler.
Title: Injective type families for Haskell
Description:
Haskell, as implemented by the Glasgow Haskell Compiler (GHC), allows expressive type-level programming.
The most popular type-level programming extension is TypeFamilies, which allows users to write functions on types.
Yet, using type functions can cripple type inference in certain situations.
In particular, lack of injectivity in type functions means that GHC can never infer an instantiation of a type variable appearing only under type functions.
In this paper, we describe a small modification to GHC that allows type functions to be annotated as injective.
GHC naturally must check validity of the injectivity annotations.
The algorithm to do so is surprisingly subtle.
We prove soundness for a simplification of our algorithm, and state and prove a completeness property, though the algorithm is not fully complete.
As much of our reasoning surrounds functions defined by a simple pattern-matching structure, we believe our results extend beyond just Haskell.
We have implemented our solution on a branch of GHC and plan to make it available to regular users with the next stable release of the compiler.

Related Results

Family Pediatrics
Family Pediatrics
ABSTRACT/EXECUTIVE SUMMARYWhy a Task Force on the Family?The practice of pediatrics is unique among medical specialties in many ways, among which is the nearly certain presence of ...
On Closed Quasi Principally Injective Acts over Monoids
On Closed Quasi Principally Injective Acts over Monoids
The concept of closed quasi principally injective acts over monoids is introduced ,which signifies a generalization for the quasi principally injective as well as for the closed qu...
SMALL PSEUDO QUASI PRINCIPALLY INJECTIVE ACTS
SMALL PSEUDO QUASI PRINCIPALLY INJECTIVE ACTS
In act theory, Pseudo injective acts and their generalizations are essential. As a result, the purpose of this work is to give a generalization of pseudo quasi principally injectiv...
Generalizations of principally quasi‐injective modules and quasiprincipally injective modules
Generalizations of principally quasi‐injective modules and quasiprincipally injective modules
Let R be a ring and M a right R‐module with S = End(MR). The module M is called almost principally quasi‐injective (or APQ‐injective for short) if, for any m ∈ M, there exists an S...
Injective edge-coloring of subcubic graphs
Injective edge-coloring of subcubic graphs
An injective edge-coloring [Formula: see text] of a graph [Formula: see text] is an edge-coloring such that if [Formula: see text], [Formula: see text], and [Formula: see text] are...
KAJIAN KEINJEKTIFAN MODUL (MODUL INJEKTIF, MODUL INJEKTIF LEMAH, MODUL MININJEKTIF)
KAJIAN KEINJEKTIFAN MODUL (MODUL INJEKTIF, MODUL INJEKTIF LEMAH, MODUL MININJEKTIF)
Abstrak. Diberikan  adalah -modul. Modul  dikatakan injektif jika untuk setiap monomorfisma   dan setiap homomorfisma  terdapat homomorfisma   sedemikian hingg...
Some Results on AWN-injective Rings
Some Results on AWN-injective Rings
A concept of AWN-injective ring is defined by [1], that is, for any   there exists  and an Y-sub module  of  (  is aright -module) such that  and  as left S-module with S=End(u ). ...
THE MILITARY FAMILY: DYNAMICS, STRENGTHS AND CHALLENGES
THE MILITARY FAMILY: DYNAMICS, STRENGTHS AND CHALLENGES
Family relationships remain one of the most valuable and meaningful human experiences, within and outside of the military, and when loss or conflict occurs, this has profound effec...

Back to Top