サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
災害への備え
www.well-typed.com
This post is the first of a series examining GHC’s support for DWARF debug information and the tooling that this support enables: Part 1 introduces DWARF debugging information and explains how its generation can be enabled in GHC. Part 2 looks at a DWARF-enabled program in gdb and examines some of the limitations of this style of debug information. Part 3 looks at the backtrace support of GHC’s ru
A co-worker of mine had a random thought on IRC: Is data type “unrolling” a valid performance optimization? Used anywhere? Something like: data List a = Nil | Cons a {-# Unroll 10 #-} (List a) I thought, that sounds like the vec package I wrote. One module there uses the GADT definition data Vec (n :: Nat) a where VNil :: Vec 'Z a (:::) :: a -> Vec n a -> Vec ('S n) a which in some cases optimizes
Now suppose Bob wants to transfer $50 to Dave. He can create a new transaction that says “take the first output of transaction t1, transfer $50 to Dave and transfer $20 back to me.”1 t2 It is important that Bob transfers the $20 “change” back to himself, because a transaction output can be “spent” (that is, used as an input) only once. This style of transactions is called “UTxO” style; UTxO stands
A generational copying garbage collector, in its most basic form, is quite simple. However, as we’ll see, not all objects can be copied, and some objects require more bookkeeping by the RTS. In this post we’re going to look at these type of objects that require special treatment from the garbage collector (GC in short). For each type of object we’ll look at how they’re allocated and collected. Eac
In object oriented programming an object is a value with a well-defined interface. The internal state of the object is closed to the outside world (encapsulation), but the behaviour of an object can be modified by redefining one or more of the functions in the object’s interface, typically through subclasses (inheritance). The internal state of the object is open to, and can be extended by, such s
A queue is a datastructure that provides efficient—O(1)—operations to remove an element from the front of the queue and to insert an element at the rear of the queue. In this blog post we will discuss how we can take advantage of laziness to implement such queues in Haskell, both with amortised and with worst-case O(1) bounds. The results in this blog post are not new, and can be found in Chris Ok
Suppose we have a webserver that can perform different kinds of operations on different kinds of values. Perhaps it can reverse or capitalize strings, and increment or negate integers: # curl http://localhost:8081/example/reverse elpmaxe # curl http://localhost:8081/example/caps EXAMPLE # curl http://localhost:8081/1234/inc 1235 # curl http://localhost:8081/1234/neg -1234 Moreover, it can echo bac
Recently, there was a question on Stack Overflow on how Servant actually works. Others were quick to suggest the Servant paper as a thorough explanation of the approach and the implementation. As a co-author, I’m obviously happy if the paper is being read, but it’s also 12 pages long in two-column ACM style. And while it explains the implementation, it does not necessarily make it easier to start
-- | Download the specified URL (..) -- -- This function will 'throwIO' an 'HttpException' for (..) simpleHttp :: MonadIO m => String -> m ByteString Notice that part of the semantics of this function—that it may throw an HttpException—is encoded in a comment, which the compiler cannot check. This is because Haskell’s notion of exceptions offers no mechanism for advertising to the user the fact th
A powerful feature of Haskell’s type system is that we can deduce properties of functions by looking only at their type. For example, a function of type can only be the identity function: since it must return something of type a, for any type a, the only thing it can do is return the argument of type a that it was given (or crash). Similarly, a function of type can only do one of two things: eithe
Way back in the summer of 2013, with support from the Google Summer of Code programme, I implemented a GHC extension called OverloadedRecordFields to address the oft-stated desire to improve Haskell’s record system. This didn’t get merged into GHC HEAD at the time, because the implementation cost outweighed the benefits. Now, however, I’m happy to report that Well-Typed are sponsoring the work req
When you ask cabal-install to install one or more packages, it needs to solve a constraint satisfaction problem: select a version for each of the packages you want to install, plus all their dependencies, such that all version constraints are satisfied. Those version constraints come both from the user (“please install lens version 4”) and from the packages themselves (“this package relies on mtl
In part 1 we looked at an overview of all the various problems that make up “Cabal hell”. We also looked at an overview of a few solutions and how they overlap. In part 2 and part 3 we’ll look in more detail at the two major solutions to Cabal hell. In this post we’ll look at Nix-style package management, and in the next post we’ll look at curated package collections. A reminder about what the pro
Suppose you are writing a compiler for some programming language or DSL. If you are doing source to source transformations in your compiler, perhaps as part of an optimization pass, you will need to construct and deconstruct bits of abstract syntax. It would be very convenient if we could write that abstract syntax using the syntax of your language. In this blog post we show how you can reuse your
At ICFP a few weeks ago a hot topic in the corridors and in a couple talks was the issues surrounding packaging and “Cabal Hell.” Fortunately we were not just discussing problems but solutions. Indeed I think we have a pretty good understanding now of where we want to be, and several solutions are in development or have reasonably clear designs in peoples’ heads. I want to explain what’s going on
One of our clients sent us a bug report, which consisted of a 700 line Haskell program with a complaint that “it deadlocks.” After studying the code I concluded that, for the sake of the bug report, it could be summarized as print a bunch of stuff, then crash with a stack overflow So I wanted to replace the original code with code that did just that: print a bunch of stuff, then crash with a stack
The foldl function is broken. Everyone knows it’s broken. It’s been broken for nearly a quarter of a century. We should finally fix it! Today I am proposing that Prelude.foldl be redefined using the implementation currently known as Data.List.foldl'. foldl is broken! I’m sure you knew that already, but just in case… Have you ever noticed that Haskellers usually recommend using either foldr or fold
Over the past few months, Duncan and I have been working with Chris Dornan and Alfredo Di Napoli on api-tools, a DSL for specifying data schemas for REST-like APIs in Haskell. If you’re interested in the real-world use of Haskell, static types and DSLs, why not come along to hear Chris talk about it? Wednesday 9th April, 6:30pm, London Find out more and register for free over at Skills Matter: Typ
ghc-events-analyze is a new simple Haskell profiling tool that uses GHC's eventlog system. It helps with some profiling use cases that are not covered by the existing GHC profiling modes or tools. It has two major features: While ThreadScope shows CPU activity across all your cores, ghc-events-analyze shows CPU activity across all your Haskell threads.It lets you label periods of time during progr
This is the first blog post by our colleague Austin. Austin is one of our GHC engineers, part of the GHC HQ team and carries the heavy burden of being GHC release manager. Today, GHC 7.8.1 RC1 has been released after many months of work, with a huge number of new features. There are some great highlights in the new release, including: A host of I/O manager improvements, which results in significan
TL;DR: GHC HEAD (but not GHC 7.8) will soon support OverloadedRecordFields, an extension to permit datatypes to reuse field labels and even turn them into lenses. IntroductionThe Haskell records system is a frequent source of frustration to Haskell programmers working on large projects. On the face of it, it is simple: a datatype such as data Person = Person { id :: Int, name :: String } gives ris
Map-ReduceIn Part 1 and Part 2 of this series we described a number of ways in which we might compute the number of prime factors of a set of numbers in a distributed manner. Abstractly, these examples can be described as a problem (computing the number of prime factors of 100 natural numbers) is split into subproblems (factorizing each number), those subproblems are solved by slave nodes, and the
Master-Slave, Work-Stealing and Work-PushingIn this series (2,3,4) of blog posts we will describe a number of basic communication patterns in Cloud Haskell. We don't assume much familiarity with Cloud Haskell, but it will probably be useful to be familiar with the basics; Towards Haskell in the Cloud (Epstein, Black and Peyton Jones, Haskell Symposium 2011) is a good starting point. We will start
The new implementationFor about the last year we have been working on a new implementation of Cloud Haskell. This is the same idea for concurrent distributed programming in Haskell that Simon Peyton Jones has been telling everyone about, but it's a new implementation designed to be robust and flexible. The summary about the new implementation is that it exists, it works, it's on hackage, and we th
From our blog The Haskell Unfolder Episode 20: Dijkstra's shortest paths Andres Löh, Edsko de Vries Wednesday, 21 February 2024 The Haskell Unfolder Episode 19: a new perspective on foldl' Andres Löh, Edsko de Vries Wednesday, 31 January 2024 info@well-typed.com | Company information | Privacy | Cookies | Copyright © 2008–2023 Well-Typed LLP
このページを最初にブックマークしてみませんか?
『Well-Typed - The Haskell Consultants』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く