Skip to content

Instantly share code, notes, and snippets.

View ndmitchell's full-sized avatar

Neil Mitchell ndmitchell

View GitHub Profile
<html>
<body>
This is a test
</body>
</html>
@ndmitchell
ndmitchell / report.html
Created March 18, 2019 13:57
Hadrian Shake profile
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Shake report</title>
<!-- Profiling output -->
<script>
var profile =
import B
main = print foo
@ndmitchell
ndmitchell / convert.html
Created February 18, 2019 21:37
Makefile to Shake online converter outline
<!DOCTYPE html>
<html>
<head>
<title>Shake Convertor</title>
<style type="text/css">
html, body, #root, tr {width: 100%; height: 100%;}
td {height: 100%}
#input, #output {height: 100%; width: 100%;}
#output {border: 2px solid gray;}
</style>

Allow qualified to follow module name

Leave blank. This will be filled in when the proposal is accepted.

Leave blank. This will eventually be filled with the Trac ticket number which will track the progress of the implementation of the feature.

Leave blank. This will be filled in with the first GHC version which implements the described feature.

{-# LANGUAGE BangPatterns, RecordWildCards #-}
import Data.List.Extra
import System.Process.Extra
import System.Directory
import System.FilePath
import System.Environment
import Data.Char
import System.IO
import Debug.Trace
@ndmitchell
ndmitchell / Types.hs
Created August 15, 2018 21:24
Compile with no ghc libraries installed
-- Compile with:
-- ghc -hide-all-packages -fforce-recomp GHC/Types.hs -this-unit-id=ghc-prim
{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
module GHC.Types where
import GHC.Prim
default ()
data Foo where
Bar :: Foo
Baz :: Foo
deriving Show
-- seems to be parsed as:
data Foo where {
Bar :: Foo;
Baz :: foo}
@ndmitchell
ndmitchell / File.hs
Created July 1, 2018 20:23
Suspending 2
suspending :: forall i k v. Ord k => Scheduler Monad i i k v
suspending rebuilder tasks target store = fst $ execState (build target) (store, Set.empty)
where
build :: k -> State (Store i k v, Set k) ()
build key = case tasks key of
Nothing -> return ()
Just task -> do
done <- gets snd
when (key `Set.notMember` done) $ do
value <- gets (getValue key . fst)
@ndmitchell
ndmitchell / GhcApi.hs
Last active June 20, 2018 19:09
GHC optimisation differences
-- Program used to compile LensOpt.hs using the GHC API
import GHC
import GhcPlugins
import GHC.Paths
main = runGhc (Just libdir) $ do
setTargets []
dflags <- getSessionDynFlags
setSessionDynFlags dflags{hscTarget = HscNothing}