Skip to content

Instantly share code, notes, and snippets.

View mpickering's full-sized avatar

Matthew Pickering mpickering

  • Well Typed LLP
  • Sheffield, UK
View GitHub Profile
@mpickering
mpickering / gist:e13f343f2b35b51693d15582180b1c02
Last active September 19, 2019 13:10
Simple GHC API executable
module Main where
import GHC as G
import GhcMake as G
import DynFlags
import SrcLoc as G
import GHC.Paths
import Control.Monad
import Control.Monad.IO.Class
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 627, types: 1,687, coercions: 398, joins: 1/6}
-- RHS size: {terms: 5, types: 21, coercions: 11, joins: 0/0}
$WUnion
$WUnion = \ @ e_XHpZ @ a_aHpZ dt_aHuO -> Union @~ <Co:11> dt_aHuO
-- | Mask an event. The first parameter is the "masking event" that masks when
-- input events are forwarded to output events. The behavior constructed by
-- `stepper False mE` defines the masking period: When True, events can pass,
-- otherwise they are accumulated internally and can not pass.
-- As soon as the masking event switches from True to False, all accumulated
-- events get triggered simultaneously.
-- mask ************* *******
-- *** ********* *******
--
-- eIn v1 v2 v3 v4 v5
@taktoa
taktoa / incremental.nix
Last active January 8, 2018 12:57
Build the profunctors library incrementally using Nix.
with builtins;
rec {
pkgs = import <nixpkgs> {};
testGHC = pkgs.haskellPackages.ghcWithPackages (p: with p; [
base base-orphans bifunctors comonad contravariant distributive
tagged transformers
]);
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Main(main) where
import GHC.Exts ( addrToAny# )
import GHC.Ptr ( Ptr(..) )
import System.Info ( os, arch )
import Encoding
import ObjLink
main :: IO ()
Authors

Merijn Verstraaten

Date

2014/11/22

So You Want to Be a Super Cool GHC Hacker?

So you have a pet peeve/bug/feature request that you'd like to see added to GHC. You made sure there was a Trac ticket for it, but despite your patient waiting no one is solving your problem. Those selfish GHC hackers!

@mietek
mietek / clang-xcode5-wrapper.hs
Created July 2, 2014 22:50
clang wrapper for GHC 7.6.3 and OS X 10.9
import System.Environment
import System.Process
import Data.List (isInfixOf)
-- | This script wraps clang to pass it essential arguments that keep it from dying when
-- GHC uses it as a C pre-processor during the build process.
-- To use it, choose the version of clang you'd like to use,
-- (GHC-iOS needs to use Xcode5's clang, which is already set here)
-- then compile it (ghc clang-xcode5-wrapper.hs).
-- Then, find your GHC settings file (usually something like /usr/local/lib/ghc-7.6.3/settings)