Variant and recursion schemes Tags: Haskell September 12, 2024 Yesterday on Reddit, someone asked the following question: What exactly is the point of recursion schemes? [..] I understand it’s usefulness from an academic perspective, understanding the similarities between different types of recursive algorithms and their common patterns, but in practice, it just seems kind of… pointless? [..] I’m…
About GHC's stability in 2024 Tags: GHC , Haskell August 7, 2024 Changelog 2024-08-08: added mention of cabal#2965 , real world issue with plugins , and Teofil’s answer. There are lots of discussions about GHC’s “stability”, making base “reinstallable”, and similar topics. As we’ve been harping on about these topics for years now, I figured I would try to summarize the issues and the current…
Contributions to GHC 9.8 Tags: GHC , Haskell November 1, 2023 This is my GHC activities report for GHC 9.8 I’ve made roughly 62 commits for the GHC 9.8 series at the time of writing (it’s difficult to know for sure because of the backports). ❯ git merge-base origin/ghc-9.8 origin/ghc-9.6 93ee7e9004c6acf01bf850a9be65c6cfe482e6f0 ❯ git log --author "Sylvain Henry" --oneline \…
Contributions to GHC 9.6 Tags: GHC , Haskell April 1, 2023 This is my GHC activities report for GHC 9.6 I’ve made roughly 38 commits for the GHC 9.6 series at the time of writing. ❯ git merge-base origin/ghc-9.6 origin/ghc-9.4 27362265e50b59aee9a0ae17560ce091f5501985 ❯ git log --author "Sylvain Henry" --oneline \ 27362265e50b59aee9a0ae17560ce091f5501985..origin/ghc-9.6 | wc --lines 38 This blog…
Contributions to GHC 9.4 Tags: GHC , Haskell August 10, 2022 This is my GHC activities report for GHC 9.4 I’ve made roughly 176 commits for the GHC 9.4 series at the time of writing. ❯ git merge-base origin/ghc-9.4 origin/ghc-9.2 05c5c0549bee022be84344cef46f0eded5564c3b ❯ git log --author "Sylvain Henry" --oneline \ 05c5c0549bee022be84344cef46f0eded5564c3b..origin/ghc-9.4 | wc --lines 176 This…
Modularizing GHC paper Tags: GHC May 3, 2022 This post is to announce the first public release of a paper we wrote about modularizing GHC (PDF) As you may know, I’ve been involved into several refactorings of GHC (adding some module hierarchy, ditching DynFlags, etc.). I have been asked a few times to write a document providing an overview of the design that we wanted to reach. I dutily started to…
On the inlining of Integer and Natural operations Tags: Haskell , Bignum April 28, 2022 In this post I discuss the inlining of Integer and Natural operations in Haskell. It’s a promising performance work I’ve been conducting six months ago, which was blocked by an independent issue, but that I will likely resume soon as the issue has been fixed in the meantime. Note: this post has been first…
Contributions to GHC 9.2 Tags: GHC , Haskell October 28, 2021 This is my GHC activities report for GHC 9.2. I’ve made roughly 204 commits for the GHC 9.2 series at the time of writing. ❯ git merge-base origin/ghc-9.2 origin/ghc-9.0 19e80b9af252eee760dc047765a9930ef00067ec ❯ git log --author "Sylvain Henry" --oneline \ 19e80b9af252eee760dc047765a9930ef00067ec..origin/ghc-9.2 | wc --lines 204 This…
Contributions to GHC 9.0 Tags: GHC , Haskell March 13, 2021 Changelog 2021-03-15: discussed on reddit This is my GHC activities report for GHC 9.0. If I’ve got the following script right, I’ve made 225 commits for the GHC 9.0 series at the time of writing. ❯ git merge-base origin/ghc-9.0 origin/ghc-8.10 098d50176a2521d08efe6fdbab0ede2b7419786a ❯ git log --author "Sylvain Henry" --oneline \…
Stack: building GHC from source Tags: GHC , Stack April 17, 2019 Stack can build packages from source with the following syntax: extra-deps: git: https://github.com/me/mypackage commit: aaaaabbbbccccdddeeeefff123456 With Stack 1.9.* we can’t use this kind of syntax to build GHC (and the other global packages such as base or template-haskell ) from source. But as my patch has been merged, the next…
Fast file embedding with GHC! Tags: GHC , Haskell , Haskus January 15, 2019 If like me you sometimes want to embed resources files into executable binaries generated by GHC, you may have already used file-embed package. We are not alone as it is directly used by 101 other packages on Hackage at the time of writing. The problem is: compile time and memory usage are awful for “big” files, where…
An answer to "The Trouble with Typed Errors" Tags: Haskell , Variant November 4, 2018 Changelog 2018-11-08 (20h30): I’ve added the “Variant + Either” approach in reaction to a reddit discussion 2018-11-08 (23h00): added section about the FlowT approach This post is a follow-up to a post Matt Parsons has just published: The Trouble with Typed Errors ( discussion on Reddit ). While I totally agree…
Announcing Variant and EADT 2.0 Tags: Haskell , EADT , Variant October 28, 2018 A short post to announce that I have just released version 2.0.1 of my haskus-utils-variant package (containing Variant and EADT). The documentation has also been greatly enhanced thanks to the feedback I’ve received: Variant: https://docs.haskus.org/variant.html EADT: https://docs.haskus.org/eadt.html As a short…
Extensible ADT (EADT) Tags: Haskell , EADT , Variant , Expression problem May 22, 2018 Introduction The expression problem (1998) In 1998, Philip Wadler defined the Expression Problem as follow: The Expression Problem is a new name for an old problem. The goal is to define a datatype by cases, where one can add new cases to the datatype and new functions over the datatype, without recompiling…
Heterogeneous collections Tags: Haskell , Variant , Heterogeneous collections February 21, 2018 This post is about managing collections (e.g., lists) of heterogeneous data types in Haskell. Summary: in my opinion, using the data type I’ve called Variant to handle heterogeneous collections is currently the best alternative. It is type-safe, efficient (both storage-wise and performance-wise) and…
Reducing GHC's noise: hiding source and object paths Tags: GHC January 15, 2018 GHC 8.2 includes a new -fhide-source-paths command-line flag that can be used to reduce line noise (disclaimer: I’m the author of the GHC patch introducing it). To use it, just add the following in your stack.yaml file: ghc-options: "$locals": -fhide-source-paths Here is an example with one project of mine (first…
Announcing haskus-system 0.7 Tags: haskus-system , Haskell June 29, 2017 What is haskus-system? haskus-system is a Haskell library for system programming on top of the Linux kernel. You can use it to build systems that only use: the Linux kernel the haskus-system library your code You can think of haskus-system as an Android-like software but in Haskell (and currently very far from being on par…
Control Flow in Haskell (3) - Flow with Variant Tags: Haskell , Control Flow , Variant December 12, 2016 This post is part of a series . Control flow with Variant We can use the Variant data type described in the previous part to help with control flow. Basically we can write functions that return a Variant to indicate their different possible output types. To make the code easier to read (fewer…
Control Flow in Haskell (2) - Variant Tags: Haskell , Variant December 12, 2016 This post is part of a series . Open sum type With some type-level hackery, we can define an open sum type in GHC which has the same internal representation as other sum types such as Either : data Variant ( types :: [ * ]) = Variant {-# UNPACK #-} ! Word Any type role Variant representational The Word value is a tag…
Control Flow in Haskell (1) - State of the art Tags: Haskell , Control Flow December 12, 2016 This post is part of a series . Unchecked Exceptions One of the good things in Haskell is that function signatures don’t lie in general. Nevertheless they do when we use unchecked exceptions. This is the prototype of the simplest of the exception-catching function catch : catch :: Exception e => IO a ->…
Control Flow in Haskell (0) - Introduction Tags: Haskell , Control Flow December 12, 2016 I have been working on improving the way we describe the control flow of Haskell programs. As the post is rather long, it is split in several parts: State of the art : briefly survey the state of the art (unchecked exceptions, Either, EitherT, etc.) and the issues I am trying to solve. Variant : describe a…
Haskell type system from the ground up (1) Tags: GHC , Haskell October 4, 2016 I was thinking about how difficult it would be to explain GHC’s advanced type system features to non-Haskell programmers. I give it a go in this series of posts. Avant donc que d’écrire, apprenez à penser. Selon que notre idée est plus ou moins obscure, L’expression la suit, ou moins nette, ou plus pure. Ce que l’on…
Predefined shared error sets considered harmful Tags: Linux , UNIX , OS April 5, 2016 Changelog 2016-11-17: title change; paragraph added about manual pages When we will design the next OS, we should definitely avoid having a static errno variable in user-space. In addition, we should also avoid having a limited predefined set of error codes. Consider the following example (from the Linux DRM…
First Experiments With Dependent Types In GHC Tags: Haskell , GHC , Dependent Types , FFI , haskus-system March 18, 2016 Update 2016-12-28: rename ViperVM into Haskus system and fix links accordingly For two weeks I have been getting my feet wet with GHC’s type extensions: DataKinds, TypeFamilies, TypeOperators, etc. I rely a lot on the Foreign Function Interface (FFI) in my Haskus system project…
libc considered harmful Tags: haskus-system , C , libc , Haskell , FFI April 1, 2014 Update 2016-12-28: rename ViperVM into Haskus system and fix links accordingly For my Haskus system project, I want to be able to manage memory at a very low-level (pinning pages into RAM, using custom allocator instead of malloc, allocating huge pages, setting execution flag, etc.). However using system calls…
UNIX philosophy: a praise for functional programming Tags: Functional programming , UNIX February 14, 2014 It is often stated that UNIX philosophy consists in writing small programs that do a single thing right and that are composable. For instance, Douglas McIlroy describes it as follows: This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work…
Continuations avec Scala Tags: Scala , CPS July 16, 2010 Une des nouveautés de Scala 2.8 est le plugin qui ajoute le support des continuations. Je vous présente un exemple dans la suite de ce post. L’exemple qui suit est repris depuis ici import scala. continuations ._ import scala. continuations . ControlContext ._ object Test { var producerCont : (Unit => Unit) = null var consumerCont : (Int =>…
Encadrer des geeks Tags: May 19, 2010 Un article très intéressant sur le management des geeks : http://www.computerworld.com/s/article/9137708/Opinion_The_unspoken_truth_about_managing_geeks “Gaining respect is not a matter of being the boss and has nothing to do with being likeable or sociable; whether you talk, eat or smell right; or any measure that isn’t directly related to the work.” “While…
SunBurn : DSL Tags: SunBurn , Raytracing , DSL , Scala June 19, 2009 J’ai commencé à créer un début de DSL (Domain Specific Language) pour SunBurn. Scala permet en effet de créer des structures qui ressemblent à d’autres langages alors qu’il s’agit de Scala normal. J’ai donc essayé de me rapprocher d’un langage de type POV-ray. Lorsque la version 2.8 de Scala sera sortie, il sera peut-être…
SunBurn : ajouts de caméras, de lumières et de matériaux Tags: SunBurn , Raytracing , Scala June 11, 2009 J’ai eu un peu de temps pour ajouter de nouveaux éléments à mon RayTracer en Scala. Tout d’abord deux nouvelles caméras (PinHole et ThinLens). Quelques sources de lumière (Directional, PointLight et Ambient). Et enfin le matériau Matte. Sur la capture on peut voir deux sphères et un plan…
SunBurn Ray Tracer - Premières images Tags: SunBurn , Raytracing , Scala May 27, 2009 J’ai commencé à développer un Ray Tracer en Scala. Pourquoi un Ray Tracer me direz-vous ? Et bien parce que je suis en train de lire le livre Ray Tracing From The Ground Up de Kevin Suffern et parce que j’avais envie ! ;) Voici donc une première capture d’écran où l’on peut voir 2 sphères (rouge et jaune) et un…
Hackers Tags: December 2, 2008 Je viens de tomber sur un texte intéressant à propos de nous, les “hackers” (au sens original du terme). The most obvious common ‘personality’ characteristics of hackers are high intelligence, consuming curiosity, and facility with intellectual abstractions. Also, most hackers are ‘neophiles’, stimulated by and appreciative of novelty (especially intellectual…
Ruby-EFL tutorial Tags: EFL November 2, 2007 I am writing a tutorial about using EFL (Enlightenment Foundations Libraries) with RUBY using bindings provided here . Even if it is not finished, I publish it: Tutorial