Network


Latest external collaboration on country level. Dive into details by clicking on the dots.

Hotspot


Dive into the research topics where Alejandro Serrano is active.

Publication


Featured researches published by Alejandro Serrano.


Theory and Practice of Logic Programming | 2014

Resource Usage Analysis of Logic Programs via Abstract Interpretation Using Sized Types

Alejandro Serrano; Pedro López-García; Manuel V. Hermenegildo

We present a novel general resource analysis for logic programs based on sized types. Sized types are representations that incorporate structural (shape) information and allow expressing both lower and upper bounds on the size of a set of terms and their subterms at any position and depth. They also allow relating the sizes of terms and subterms occurring at different argument positions in logic predicates. Using these sized types, the resource analysis can infer both lower and upper bounds on the resources used by all the procedures in a program as functions on input term (and subterm) sizes, overcoming limitations of existing resource analyses and enhancing their precision. Our new resource analysis has been developed within the abstract interpretation framework, as an extension of the sized types abstract domain, and has been integrated into the Ciao preprocessor, CiaoPP. The abstract domain operations are integrated with the setting up and solving of recurrence equations for inferring both size and resource usage functions. We show that the analysis is an improvement over the previous resource analysis present in CiaoPP and compares well in power to state of the art systems.


european symposium on programming | 2016

Type Error Diagnosis for Embedded DSLs by Two-Stage Specialized Type Rules

Alejandro Serrano; Jurriaan Hage

In the functional programming world, it is common to embed a domain specific language DSL in a general purpose language. Unfortunately, the extra abstraction layer provided by the DSL is lost when a type error occurs, and internals leak to users of the DSL. This paper presents specialized type rules, a way to influence which part of the program is blamed and how the particular error message is worded. These type rules match part of the programming language abstract syntax tree AST and guide the type checker in order to provide custom diagnostics. Our goal is to enable DSL writers to keep their high-level abstractions throughout the whole development experience. Specialized type rules have already been considered in the literature: we enhance them by providing a mechanism to allow type rules to depend on partial type information. The technique presented in this paper can be readily applied to any type engine which uses constraints to perform its duty. We refine the workings of the type engine by including a second gathering pass in case an error is found. In that second pass, partial type information can be used to select a type rule. In particular, we have implemented our techniques in a type engine based on the OutsideInX framework, which underlies the Haskell GHC compiler since version 7.


symposium/workshop on haskell | 2015

Type families with class, type classes with family

Alejandro Serrano; Jurriaan Hage; Patrick Bahr

Type classes and type families are key ingredients in Haskell programming. Type classes were introduced to deal with ad-hoc polymorphism, although with the introduction of functional dependencies, their use expanded to type-level programming. Type families also allow encoding type-level functions, but more directly in the form of rewrite rules. In this paper we show that type families are powerful enough to simulate type classes (without overlapping instances), and we provide a formal proof of the soundness and completeness of this simulation. Encoding instance constraints as type families eases the path to proposed extensions to type classes, like closed sets of instances, instance chains, and control over the search procedure. The only feature which type families cannot simulate is elaboration, that is, generating code from the derivation of a rewriting. We look at ways to solve this problem in current Haskell, and propose an extension to allow elaboration during the rewriting phase.


international symposium on haskell | 2018

Generic programming of all kinds

Alejandro Serrano; Victor Cacciari Miraldo

Datatype-generic programming is a widely used technique to define functions that work regularly over a class of datatypes. Examples include deriving serialization of data, equality or even functoriality. The state-of-the-art of generic programming still lacks handling GADTs, multiple type variables, and some other features. This paper exploits modern GHC extensions, including TypeInType, to handle arbitrary number of type variables, constraints, and existentials. We also provide an Agda model of our construction that does not require Russel’s paradox, proving the construction is consistent.


partial evaluation and semantic-based program manipulation | 2017

Lightweight soundness for towers of language extensions

Alejandro Serrano; Jurriaan Hage

It is quite natural to define a software language as an extension of a base language. A compiler builder usually prefers to work on a representation in the base language, while programmers prefer to program in the extended language. As we define a language extension, we want to ensure that desugaring it into the base language is provably sound. We present a lightweight approach to verifying soundness by embedding the base language and its extensions in Haskell. The embedding uses the final tagless style, encoding each language as a type class. As a result, combination and enhancement of language extensions are expressed in a natural way. Soundness of the language extension corresponds to well-typedness of the Haskell terms, so no extra tool but the compiler is needed.


practical aspects of declarative languages | 2016

Generic Matching of Tree Regular Expressions over Haskell Data Types

Alejandro Serrano; Jurriaan Hage

Tree regular expressions are a generalization of string regular expressions to tree-shaped data. In this paper we apply the theory of tree regular expressions to extend pattern matching on Haskell data types. We define the operations in a data type-generic way, looking at data types as fixed-points of pattern functors and using the Generic implementation available in the GHC Haskell compiler.


programming language design and implementation | 2018

Guarded impredicative polymorphism

Alejandro Serrano; Jurriaan Hage; Dimitrios Vytiniotis; Simon L. Peyton Jones

The design space for type systems that support impredicative instantiation is extremely complicated. One needs to strike a balance between expressiveness, simplicity for both the end programmer and the type system implementor, and how easily the system can be integrated with other advanced type system concepts. In this paper, we propose a new point in the design space, which we call guarded impredicativity. Its key idea is that impredicative instantiation in an application is allowed for type variables that occur under a type constructor. The resulting type system has a clean declarative specification — making it easy for programmers to predict what will type and what will not —, allows for a smooth integration with GHC’s OutsideIn(X) constraint solving framework, while giving up very little in terms of expressiveness compared to systems like HMF, HML, FPH and MLF. We give a sound and complete inference algorithm, and prove a principal type property for our system.


Proceedings of the 3rd ACM SIGPLAN International Workshop on Type-Driven Development | 2018

Sums of products for mutually recursive datatypes: the appropriationist’s view on generic programming

Victor Cacciari Miraldo; Alejandro Serrano

Generic programming for mutually recursive families of datatypes is hard. On the other hand, most interesting abstract syntax trees are described by a mutually recursive family of datatypes. We could give up on using that mutually recursive structure, but then we lose the ability to use those generic operations which take advantage of that same structure. We present a new approach to generic programming that uses modern Haskell features to handle mutually recursive families with explicit sum-of-products structure. This additional structure allows us to remove much of the complexity previously associated with generic programming over these types.


implementation and application of functional languages | 2017

Type Error Customization in GHC: Controlling expression-level type errors by type-level programming

Alejandro Serrano; Jurriaan Hage

Embedded domain specific languages (DSLs) are a common pattern in the functional programming world, providing very high-level abstractions to programmer. Unfortunately, this abstraction is broken when type errors occur, leaking details of the DSL implementation. In this paper we present a set of techniques for customizing type error diagnosis in order to avoid this leaking. These techniques have been implemented in the GHC Haskell compiler. Our customizations are declared in the type signatures of functions provided by the DSL, leading to type error message that are context-dependent: the same kind of error can be reported in a different way depending on the particular expression in which it occurs. We make use of the ability to manipulate constraints using type-level programming which is already present in GHC, and which enables reuse and abstraction of common type error patterns.


Theory and Practice of Logic Programming | 2017

Constraint Handling Rules with Binders, Patterns and Generic Quantification

Alejandro Serrano; Jurriaan Hage

Constraint Handling Rules provide descriptions for constraint solvers. However, they fall short when those constraints specify some binding structure, like higher-rank types in a constraint-based type inference algorithm. In this paper, the term syntax of constraints is replaced by

Collaboration


Dive into the Alejandro Serrano's collaboration.

Top Co-Authors

Avatar
Top Co-Authors

Avatar
Top Co-Authors

Avatar
Top Co-Authors

Avatar

Francisco Bueno

Technical University of Madrid

View shared research outputs
Top Co-Authors

Avatar

Patrick Bahr

University of Copenhagen

View shared research outputs
Researchain Logo
Decentralizing Knowledge