Skip to content

Instantly share code, notes, and snippets.

New summary by @ezyang.
The goal of this task is to add a new command `Setup doctest`, which runs the doctest command on all of the modules of each component in a package, in much the same way `Setup haddock` runs `haddock` on all the modules of each component in a package.
There are a number of steps to implementing this:
1. You have to add the boilerplate for setting doctest up as a new command. Grepping for occurrences of haddock should give you an idea for what you have to edit; the key files are `Cabal/Distribution/Simple/Setup.hs`, adding a case to `defaultMainHelper` in `Cabal/Distribution/Simple.hs`, and a new file to actually contain the logic. I'd recommend against putting too many flags into `DoctestFlags` when starting off.
2. The overall logic of the driver should be something like this:
@ezyang
ezyang / .vimrc
Created April 10, 2017 23:39
My vimrc
" https://github.com/tpope/vim-pathogen
" Pathogen is good because you can keep plugins together in logical
" units, without blasting them throughout your directory structure.
execute pathogen#infect()
" This just turns on per-filetype plugins. Vim ships with file
" indentation/plugin/syntax rules for highlighting. The highlighting
" is nice. Sometimes the indentation is a bit annoying though because
" it REINDENTS my stupid code when I didn't want it to. It's annoying
" to track down why it's doing that...

| Str.String| Str.Text| Str.Text.Lazy ---| ---| ---| --- Str | ✔| ✔| ✔ Chr | ✔| ✔| ✔ Index | ✔| ✔| ✔ empty | ✔| ✔| ✔ singleton | ✔| ✔| ✔ pack | ✔| ✔| ✔ unpack | ✔| ✔| ✔ cons | ✔| |

@ezyang
ezyang / haskell-on-windows.md
Last active November 17, 2016 00:00
Haskell on Windows for Linux refugees

Haskell on Windows

These are empirical observations about running Haskell on Windows. If your experiences have been different, I'd love to hear about it.

Install

You'll need to get the

In Backpack, we both typecheck packages with holes (producing only interface files) and compile fully instantiated packages (producing interface files and object files). While doing this, we try to minimize the amount of work the compiler does. In particular:

  1. Any package with holes is typechecked exactly once, in its most general form (with no instantiations). Partially instantiated packages are never typechecked; instead, we just rename the most general interfaces according to the instantiation "on the fly."
@ezyang
ezyang / GhcSort.hs
Created September 27, 2016 21:21
A simple frontend plugin that prints all modules of a project in topological order
module GhcSort where
import GHC
import GhcPlugins
import DriverPhases
import Control.Monad
import Data.List
import Data.Maybe
import System.FilePath
@ezyang
ezyang / ghc-make.rst
Created August 22, 2016 08:49
Notes on GHC make

How ghc --make works

In abstract, the job of ghc --make is very simple: compute a dependency graph between modules, and rebuild the ones that have changed. Unfortunately, the code in GhcMake is quite a bit more complicated than that, and some of this complexity is essential to the design of GHC:

  • Interaction with GHCi involves mutating process-global state.
@ezyang
ezyang / Productive.hs
Created June 10, 2016 09:51
Productive coprogramming in the Par monad
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE InstanceSigs #-}
module Productive where
-- | Productive coprogramming in the Par monad. Based off of
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAvPFdNkCBdTqqKVsvI1URwYtsIZz4YwqHE/99nDfB22F5/tFMHVayTwLe6LLPu4U8YaOW01xHnQTOh+Y/dkaXDscV5XzwniPhueRdkU31TH2cgfq7LebIpoPa3vzwzdioq5GY0M2KH6qv/Ro11RDho8VKPRHZhnMlBDBU7kOKy+9aL/LcJTEaEMO1WzgG17rKQVScKMzqcjgZ7150hE9eeIDA8NwH9e4fq5X2qTwLYpz2ndq3X+B/ugq5U1s/b5JxSoQQth0RKwonAq6mbixBj6FYEpUqpkAksmJXqW4d0kG0D9EAUEFDM9drY9r3azaURT9yJLDTvFJStIZ1Am54xQ== ezyang-sabre
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAxDoJ6C1oKYT/wkxLuQPxylQsYEWiulWumGI7ShQ7KhKZo2T/9t4OD0lsMYAZP2FnwjIkD1SIVetUqb8/4JtY9Oqyvx72QoXk+TFQ4gDLXLuIovF9DpHgZOnYzEk8IAQE4DmFkT94YSwPJzST3FfuGUpfwpE3ouOdRmUs+yxbOQrx+7IfhhLdRCYDgCyzAKP9bkfRlVJ6QJLxFFpj8H4zPlwQd+QggFWKkhL9t/KTvPZ9I7zpF95lfOtgSlNlUNCBuWzdNkH7f4KoF2IkCfGQQ5U/8jjdngDHjDToL7cjLddOO2zvbAl0kqJpkvBBaA36Goe3trm9TLKc4fPnq0leqQ==