Posted on 2026-05-07 by Oleg Grenrus engineering Seven years ago I wrote a post about compatibility packages. It is now highly outdated, so let us revisit the matter. Recently there have been a small push towards reinstallable base . While it's still far from being a thing, it made me remember that using impl(ghc >= 7.9) -like conditionals to guard against different base versions is semantically…
Posted on 2025-02-13 by Oleg Grenrus agda Recently I looked again at PHOAS, and once again I concluded it's nice for library APIs, but so painful to do anything with inside those libraries. So let convert to something else, like de Bruijn. There are standalone source files if you just want to see the code: Agda: https://github.com/phadej/nbexp/blob/master/src/NbEXP/SelfContained/Conv.agda Haskell:…
Posted on 2025-02-11 by Oleg Grenrus agda Normalization by evaluation using parametric higher order syntax. In Agda. I couldn't find a self-contained example of PHOAS NbE, so here it is. I hope someone might find it useful. module NbEXP . PHOAS where data Ty : Set where emp : Ty fun : Ty → Ty → Ty data Tm ( v : Ty → Set ) : Ty → Set where var : ∀ { a } → v a → Tm v a app : ∀ { a b } → Tm v ( fun a…
Posted on 2024-06-24 by Oleg Grenrus In hashable-1.4.5.0 I made it use a XXH3 algorithm for hashing byte arrays. The version 1.4.5.0 and 1.4.6.0 backlashed, as I enabled -march=native by default, and that causes distribution issues. Version 1.4.7.0 doesn't enable -march=native by default. This by default leaves some performance on the table, e.g. a quick benchmark comparison on my machine ( model…
Posted on 2024-05-28 by Oleg Grenrus cabal-fields is partly motivated by the Migrate from the .cabal format to a widely supported format issue. Whether it's a solution or not, it's up to you to decide. Envelope grammar vs. specific format grammar It is important to separate the envelope format (whether it's JSON, YAML, TOML, or cabal-like) from the actual file format ( package.json , stack.yaml ,…
Posted on 2024-04-21 by Oleg Grenrus Safe coercions in GHC are a very powerful feature. However, they are not perfect; and already many years ago I was also thinking about how we could make them more expressive. In particular such things like "higher-order roles" have been buzzing. For the record, I don't think Proposal #233 is great; but because that proposal is almost four years old, I don't…
Posted on 2024-04-18 by Oleg Grenrus Recently I came up with a criteria for a good warning to have in a compiler: If compiler makes a choice, or has to deal with some complication, it may well tell about that. That made me think about warnings I implemented into GHC over the years. They are fine. Let us first understand the criteria better. It is better explained by an example which triggers few…
Posted on 2024-04-12 by Oleg Grenrus inspection-testing was created over five years ago. You may want to glance over Joachim Breitner A promise checked is a promise kept: inspection testing ) Haskell Symposium paper introducing it. Already in 2018 I thought it's a fine tool, but it's more geared towards /library/ writers. They can check on (some) examples that the promises they make about the…
Posted on 2024-04-01 by Oleg Grenrus In programming languages with sophisticated type systems we easily run into inconvenience of providing many (often type) arguments explicitly. Let's take a simple map function as an example: map :: forall a b . (a -> b) -> List a -> List b If we had to always explicitly provide map 's arguments, write something like ys = map @ Char @ Char toLower xs we would…
Posted on 2024-03-17 by Oleg Grenrus Implementation I wish there were an early exit functionality in the ST monad. This need comes time to time when writing imperative algorithms in Haskell. It's very likely there is a functional version of an algorithm, but it might be that ST -version is just simply faster, e.g. by avoiding allocations (as allocating even short lived garbage is not free). But…