Skip to content

Instantly share code, notes, and snippets.

Nathan Howell NathanHowell

Block or report user

Report or block NathanHowell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
NathanHowell / stack.yaml
Created Feb 3, 2016
GHC 8.0 release candidate stack/stackage yaml
View stack.yaml
resolver: ghc-
url: ""
content-length: 111404852
sha1: 30d39c6ca6994dcafe25595e053035ad23198b52
View better-compile-errors.hs
instance (a ~ Proxy "Sum types are not supported by LLVM") => GGetElementIndex a (x :+: y) where
type GGetElementPtrType a (x :+: y) = Void
ggetElementIndex _ _ = error "Sum types are not supported by LLVM"
type family StructElement (a :: [*]) (n :: Nat) :: * where
StructElement (x ': xs) 0 = x
StructElement (x ': xs) n = StructElement xs (n - 1)
StructElement '[] n = Proxy "Attempting to index past end of structure"
NathanHowell / 1.idr
Last active Mar 23, 2016
A port of `Fin` and `natToFin` from Idris to Haskell.
View 1.idr
module Data.Fin
%default total
%access public export
||| Numbers strictly less than some bound. The name comes from "finite sets".
||| It's probably not a good idea to use `Fin` for arithmetic, and they will be
||| exceedingly inefficient at run time.
||| @ n the upper bound
NathanHowell / error.txt
Last active Jan 1, 2016
GNTD regressions in GHC HEAD. This typechecks on 7.6.3 but not on 7.7.20131217 unless ImpredicativeTypes are enabled.
View error.txt
[1 of 1] Compiling Repro ( repro.hs, interpreted )
Cannot instantiate unification variable ‛b0’
with a type involving foralls:
(forall r. (a1 -> IO r) -> IO r) -> DecodeAST a1
Perhaps you want ImpredicativeTypes
In the expression:
(anyContToM ::
NathanHowell / gist:6880968
Created Oct 8, 2013
Convert a type to a nested tuple, preserving left-to-right ordering via CPS conversion.
View gist:6880968
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Typeable
convert :: (Typeable t, Typeable b) => (forall a . Typeable a => a -> r) -> [t] -> b -> r
convert f (x:xs) b = convert f xs (x, b)
convert f [] b = f b
View .gitignore
View barf.txt
gdb ./a.out
GNU gdb 6.3.50-20050815 (Apple version gdb-1820) (Sat Jun 16 02:40:11 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done
(gdb) run
View A.cmm
#include <Cmm.h>
getInfoTable (P_ a)
W_ clos, info, type;
clos = UNTAG(a);
info = %GET_STD_INFO(clos);
return (info);
NathanHowell / thread-fixio.hs
Created Aug 10, 2013
Passing a threadID to a thread
View thread-fixio.hs
import Control.Concurrent
import System.IO
t :: ThreadId -> IO ()
t tid = print ("mah thread", tid)
main :: IO ()
main = do
_tid <- fixIO (forkIO . t)
threadDelay 100000000
NathanHowell / cn.hs
Last active Dec 20, 2015
Printing out data constructor names using GHC.Generics
View cn.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE TypeOperators #-}
import Data.Proxy
import GHC.Generics
You can’t perform that action at this time.