Skip to content

Instantly share code, notes, and snippets.

View DanBurton's full-sized avatar

Dan Burton DanBurton

View GitHub Profile
@DanBurton
DanBurton / stack-info-gen.hs
Created February 26, 2018 00:27
script to generate a stack.yaml with "setup-info" for ghc-8.2-rc1 (ghc-8.4.0.20180224)
#!/usr/bin/env stack
{- stack
script
--resolver lts-10.2
--package bytestring
--package http-conduit
-}
-- usage: ./Main.hs
-- modify the baseUrl and ghcDateVersion to taste
@DanBurton
DanBurton / curator-removalizer.hs
Created March 17, 2018 17:51
Parses stackage-curator output (on stderr, saved in "scheck.txt") and transforms this into package removals for build-constraints.yaml (printed to "removalizer.txt")
#!/usr/bin/env stack
{- stack
script
--resolver lts-10.2
-}
module Main where
import qualified Data.Char as Char
import Data.Semigroup ((<>))
@DanBurton
DanBurton / setup-info-gen.hs
Last active August 21, 2018 00:14
Generate a stack.yaml that can install ghc-8.6.1-beta1 (aka ghc-8.6.0.20180810)
#!/usr/bin/env stack
{- stack
script
--resolver lts-11.16
--package bytestring
--package http-conduit
-}
-- usage: ./Main.hs
-- modify the baseUrl and ghcDateVersion to taste
@DanBurton
DanBurton / stack.yaml
Last active September 24, 2018 01:51
stack.yaml with "setup-info" for ghc-8.6.1-beta1 (aka ghc-8.6.0.20180810)
# Generated from https://gist.github.com/DanBurton/5b7fc5fae1ebfdc5bcaecfbac15d2903
setup-info:
ghc:
windows32:
8.6.0.20180810:
url: https://downloads.haskell.org/~ghc/8.6.1-beta1/ghc-8.6.0.20180810-i386-unknown-mingw32.tar.xz
sha256: 9be35662d510d3489ddd583e7d9d38ee6b6ba40b852f6e90e0dfd97a0d7bbfd3
linux32-nopie:
8.6.0.20180810:
#lang typed/racket
(require (for-syntax syntax/parse))
(require typed/net/url)
(require racket/control)
(require/typed xml
[xexpr->string (Xexpr -> String)])
@DanBurton
DanBurton / FromIntegralMay.hs
Created February 27, 2019 04:22
Safe integral coercions via bounds checking
{-# LANGUAGE ScopedTypeVariables, TypeApplications #-}
import Data.Int (Int32, Int64)
fromIntegralMay :: forall b a. (Bounded b, Integral a, Integral b) => a -> Maybe b
fromIntegralMay a | a > fromIntegral (maxBound @b) || a < fromIntegral (minBound @b) = Nothing
fromIntegralMay a = Just (fromIntegral a)
justMin = fromIntegralMay @Int32 (-2147483648 :: Int64)
justMax = fromIntegralMay @Int32 (2147483647 :: Int64)
@DanBurton
DanBurton / haskell-packages-extendo.nix
Last active March 9, 2019 18:18
Convenience of "extend", implemented with "override"
self: super:
let
r = rec {
# addExtendo : haskellPackages -> extension
addExtendo = newHp: _: _: {
extendo = hpExtendo newHp;
};
# hpExtendo : haskellPackages -> extension -> haskellPackages
# performs the extension, and also performs the addExtendo extension afterwards.
hpExtendo = hp: extension:
cd /tmp
mkdir ghc-test && cd ghc-test
wget https://raw.githubusercontent.com/DanBurton/stack-setup-info-gen/master/output/stack-ghc-8.8.1-alpha1.yaml
mv stack-ghc-8.8.1-alpha1.yaml stack.yaml
stack setup
stack repl

Keybase proof

I hereby claim:

  • I am danburton on github.
  • I am danburton (https://keybase.io/danburton) on keybase.
  • I have a public key ASDWfyHJVknV_V0NtnjEH6bguSeVgQl9e7cEZuH2YLFOWQo

To claim this, I am signing this object:

VERSION=8.8.1-alpha2
cd /tmp
mkdir ghc-test && cd ghc-test
wget https://raw.githubusercontent.com/DanBurton/stack-setup-info-gen/master/output/stack-ghc-$VERSION.yaml
mv stack-ghc-$VERSION.yaml stack.yaml
stack setup
stack repl