Skip to content

Instantly share code, notes, and snippets.

@unclechu
Created July 23, 2020 01:42
Show Gist options
  • Save unclechu/3a5bee3229ae7a8a12283fe233ff4edd to your computer and use it in GitHub Desktop.
Save unclechu/3a5bee3229ae7a8a12283fe233ff4edd to your computer and use it in GitHub Desktop.
List of “base” package versions attached to specific version of GHC
<style>
table th, table td {
border: 1px solid black;
}
</style>
<table dir="auto">
<tr>
<th><b>8.10.1</b></th>
<th><b>8.8.3</b></th>
<th><b>8.8.2</b></th>
<th><b>8.8.1</b></th>
<th><b>8.6.5</b></th>
<th><b>8.6.4</b></th>
<th><b>8.6.3</b></th>
<th><b>8.6.2</b></th>
<th><b>8.6.1</b></th>
<th><b>8.4.4</b></th>
<th><b>8.4.3</b></th>
<th><b>8.4.2</b></th>
<th><b>8.4.1</b></th>
<th><b>8.2.2</b></th>
<th><b>8.2.1</b></th>
<th><b>8.0.2</b></th>
<th><b>8.0.1</b></th>
<th><b>7.10.3</b></th>
<th><b>7.10.2</b></th>
<th><b>7.10.1</b></th>
<th><b>7.8.4</b></th>
<th><b>7.8.3</b></th>
<th><b>7.8.2</b></th>
<th><b>7.8.1</b></th>
<th><b>7.6.3</b></th>
<th><b>7.6.2</b></th>
<th><b>7.6.1</b></th>
<th><b>7.4.2</b></th>
<th><b>7.4.1</b></th>
<th><b>7.2.2</b></th>
<th><b>7.2.1</b></th>
<th><b>7.0.4</b></th>
<th><b>7.0.3</b></th>
<th><b>7.0.2</b></th>
<th><b>7.0.1</b></th>
</tr>
<tr>
<td>4.14.0.0</td>
<td colspan="3">4.13.0.0</td>
<td colspan="5">4.12.0.0</td>
<td colspan="3">4.11.1.0</td>
<td>4.11.0.0</td>
<td>4.10.1.0</td>
<td>4.10.0.0</td>
<td>4.9.1.0</td>
<td>4.9.0.0</td>
<td>4.8.2.0</td>
<td>4.8.1.0</td>
<td>4.8.0.0</td>
<td>4.7.0.2</td>
<td>4.7.0.1</td>
<td colspan="2">4.7.0.0</td>
<td colspan="2">4.6.0.1</td>
<td>4.6.0.0</td>
<td>4.5.1.0</td>
<td>4.5.0.0</td>
<td>4.4.1.0</td>
<td>4.4.0.0</td>
<td colspan="3">4.3.1.0</td>
<td>4.3.0.0</td>
</tr>
</table>
GHC base
8.10.1 4.14.0.0
8.8.3 4.13.0.0
8.8.2 4.13.0.0
8.8.1 4.13.0.0
8.6.5 4.12.0.0
8.6.4 4.12.0.0
8.6.3 4.12.0.0
8.6.2 4.12.0.0
8.6.1 4.12.0.0
8.4.4 4.11.1.0
8.4.3 4.11.1.0
8.4.2 4.11.1.0
8.4.1 4.11.0.0
8.2.2 4.10.1.0
8.2.1 4.10.0.0
8.0.2 4.9.1.0
8.0.1 4.9.0.0
7.10.3 4.8.2.0
7.10.2 4.8.1.0
7.10.1 4.8.0.0
7.8.4 4.7.0.2
7.8.3 4.7.0.1
7.8.2 4.7.0.0
7.8.1 4.7.0.0
7.6.3 4.6.0.1
7.6.2 4.6.0.1
7.6.1 4.6.0.0
7.4.2 4.5.1.0
7.4.1 4.5.0.0
7.2.2 4.4.1.0
7.2.1 4.4.0.0
7.0.4 4.3.1.0
7.0.3 4.3.1.0
7.0.2 4.3.1.0
7.0.1 4.3.0.0
#! /usr/bin/env nix-shell
#! nix-shell -i runhaskell
#! nix-shell -E "let ghc = n.haskellPackages.ghcWithPackages (p: [p.text]); d = n.mkShell { buildInputs = [ghc]; }; n = import (fetchTarball { url = \"https://github.com/NixOS/nixpkgs/archive/db31e48c5c8d99dcaf4e5883a96181f6ac4ad6f6.tar.gz\"; sha256 = \"1j5j7vbnq2i5zyl8498xrf490jca488iw6hylna3lfwji6rlcaqr\"; }) {}; in d"
{-# LANGUAGE UnicodeSyntax, OverloadedStrings, ScopedTypeVariables #-}
{-# OPTIONS_GHC -threaded #-}
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Function
import Data.Functor
import Text.Read
import Numeric.Natural
import Data.Maybe
import Control.Monad
import Control.Arrow
(⋄) = (<>)
-- https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
main ∷ IO ()
main = do
(ghcBaseVerMap :: [(T.Text, T.Text)]) ←
T.readFile "ghc-base-history.html"
<&> T.lines
<&> dropWhile (not . T.isPrefixOf "<table")
<&> dropWhile (not . T.isPrefixOf "<th")
<&> takeWhile (/= "</table>")
<&> fmap (T.replace "<b>" "" . T.replace "</b>" "")
<&> span (/= "</tr>")
<&> second (dropWhile (not . T.isPrefixOf "<td"))
<&> second (takeWhile (/= "</tr>"))
<&> (fmap (T.replace "<th>" "" >>> T.replace "</th>" "") ***
fmap (T.replace "<td>" "" >>> T.replace "</td>" ""))
<&> second (fmap (T.breakOnEnd "\">"))
<&> second (fmap (first ( (readMaybe :: String -> Maybe Int)
. T.unpack
. T.filter (`elem` ['0'..'9']))) )
<&> second (foldMap (uncurry replicate . first (fromMaybe 1)))
<&> uncurry zip
let
(max1, max2)
= foldl (flip $ \(a, b) -> max a *** max b) (0 :: Int, 0 :: Int)
$ fmap (T.length *** T.length) ghcBaseVerMap
title1 = "GHC"
title2 = "base"
T.putStrLn $
"| " ⋄ title1 ⋄ T.replicate (max1 - T.length title1) " " ⋄ " " ⋄
"| " ⋄ title2 ⋄ T.replicate (max2 - T.length title2) " " ⋄ " |"
T.putStrLn $
"| " ⋄ T.replicate max1 "-" ⋄ " | " ⋄ T.replicate max2 "-" ⋄ " |"
forM_ ghcBaseVerMap $ \(ghc, base) → T.putStrLn $
"| " ⋄ ghc ⋄ T.replicate (max1 - T.length ghc) " " ⋄ " " ⋄
"| " ⋄ base ⋄ T.replicate (max2 - T.length base) " " ⋄ " |"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment