ghc-debug is a debugging tool for performing precise heap analysis of Haskell programs (check out our previous post introducing it). While working on Eras Profiling, we took the opportunity to make some much needed improvements and quality of life fixes to both the ghc-debug library and the...
This is the first of a two-part series of blog posts on GHC specialization, an optimization technique used by GHC to eliminate the performance overhead of ad-hoc polymorphism and enable other powerful optimizations. There will also be a Haskell Unfolder episode about this topic.
data Stream a = forall s. Stream !(s -> Step s a) !s
data Step s a = Yield a !s | Skip !s | Done
data Tup a b = Tup !a !b
cartesianProduct :: Stream a -> Stream b -> Stream (a, b)
cartesianProduct (Stream step1 s01) (Stream step2 s02) = Stream step' s' where
s' = Tup s01 s02
step' (Tup s1 s2) =
case step1 s1 of
Yield x s1' ->
case step2 s2 of
Yield y s2' -> Yield (x, y) (Tup s1 s2')
Skip s2' -> Skip (Tup s1 s2')
Done -> Skip (Tup s1' s02)
Skip s1' -> Skip (Tup s1' s2)
Done -> Done
eft :: Int -> Int -> Stream Int
eft x y = Stream step x where
step s
| s > y = Done
| otherwise = Yield s (s + 1)
fooS :: Stream (Int, Int)
fooS = cartesianProduct (eft 0 10) (eft 0 10)
toList :: Stream a -> [a]
toList (Stream step s0) = go s0 where
go !s =
case step s of
Yield x s' -> x : go s'
Skip s' -> go s'
Done -> []
foo :: [(Int,Int)]
foo = toList fooS
@someodd Also note that the advice is about Stackage and not Stack. You can use Stackage snapshots with Cabal. E.g. you can create a cabal.project file with a line like this: import: https://www.stackage.org/lts-22.16/cabal.config. It still has a lot of rough edges, for example it is not possible to override specific constraints from the snapshots, but it is usable.
@DiazCarrete That slide seems to misrepresent effect systems. It is easy to replace just runInputConst:
runAllEffects (runInputDifferently program)
The runInputDifferently effect handles the Input Config effect and it leaves an unused Input Config in the list of effects. So the runInputConst config handler in runAllEffects will not be used.
Roman, known better online as effectfully, is interviewed by Wouter and Joachim. On his path to becoming a Plutus language developer at IOG, he learned English to read Software Foundations, has encountered many spaceleaks, and used Haskell to prevent robots from killing people.
Is it just me or is this whole thing about „don’t do X if you don’t really know what you’re doing“ really counter productive? Many people live in fear of X now and don’t start thinking if X is an actual problem or learn what the problems are that could rise from X.
I see this very often in the #haskell ecosystem where the solution to doing X properly is often learnt in a few minutes investigation.
@mangoiv I know I've said that a few times. Two examples I can think of:
AllowAmbiguousTypes, GHC suggests this but you should probably just use Proxy arguments instead.
Typeable, people coming from OOP languages often want a typeof function, but 99% of the time there is a better way to structure your programs using simple ADTs.
I still think these are not learnt in a few minutes. Even if that was the case, the most important thing you should learn is that you shouldn't use them very often.
In this post I want to make this kind of simplicity more precise and talk about some reasons it’s important. I propose five key ideas for simple programming languages: ready-at-hand features, fast iteration cycles, a single way of doing things, first-order reasoning principles, and simple static type systems. I discuss each of...
The machine itself can generally only do very simple things
I disagree. Assembly languages for modern architectures are a complexity hell. You need books with thousands of pages to explain how they work. In comparison the lambda calculus is much simpler.
When composing several list-processing functions, GHC employs an optimisation called foldr-build fusion. Fusion combines functions in such a way that any intermediate lists can often be eliminated completely. In this episode, we will look at how this optimisation works, and at how it is implemented in GHC: not as built-in...
Issue 418 :: Haskell Weekly newsletter (haskellweekly.news)
News about the Haskell programming language from 2024-05-02.
[Well-Typed Blog] Improvements to the ghc-debug terminal interface (www.well-typed.com)
ghc-debug is a debugging tool for performing precise heap analysis of Haskell programs (check out our previous post introducing it). While working on Eras Profiling, we took the opportunity to make some much needed improvements and quality of life fixes to both the ghc-debug library and the...
Bluefin, a new effect system (discourse.haskell.org)
I've mentioned my new effect system, Bluefin, a few times on this forum. It's now ready for me to announce it more formally....
Issue 416 :: Haskell Weekly newsletter (haskellweekly.news)
News about the Haskell programming language from 2024-04-18.
[Well-Typed Blog] Choreographing a dance with the GHC specializer (Part 1) (well-typed.com)
This is the first of a two-part series of blog posts on GHC specialization, an optimization technique used by GHC to eliminate the performance overhead of ad-hoc polymorphism and enable other powerful optimizations. There will also be a Haskell Unfolder episode about this topic.
OC TIL: wrapping list comprehension in a function can prevent fusion
This fuses:...
Oleg's gists - Core Inspection (oleg.fi)
Issue 415 :: Haskell Weekly newsletter (haskellweekly.news)
News about the Haskell programming language from 2024-04-11.
Issue 414 :: Haskell Weekly newsletter (haskellweekly.news)
News about the Haskell programming language from 2024-04-04.
Haskell Interlude 46: effectfully (haskell.foundation)
Roman, known better online as effectfully, is interviewed by Wouter and Joachim. On his path to becoming a Plutus language developer at IOG, he learned English to read Software Foundations, has encountered many spaceleaks, and used Haskell to prevent robots from killing people.
Issue 413 :: Haskell Weekly newsletter (haskellweekly.news)
News about the Haskell programming language from 2024-03-28.
Simple Programming Languages (ryanbrewer.dev)
In this post I want to make this kind of simplicity more precise and talk about some reasons it’s important. I propose five key ideas for simple programming languages: ready-at-hand features, fast iteration cycles, a single way of doing things, first-order reasoning principles, and simple static type systems. I discuss each of...
Issue 412 :: Haskell Weekly newsletter (haskellweekly.news)
News about the Haskell programming language from 2024-03-21.
The Haskell Unfolder Episode 22: foldr-build fusion (well-typed.com)
When composing several list-processing functions, GHC employs an optimisation called foldr-build fusion. Fusion combines functions in such a way that any intermediate lists can often be eliminated completely. In this episode, we will look at how this optimisation works, and at how it is implemented in GHC: not as built-in...