Skip to content

Instantly share code, notes, and snippets.

View cartazio's full-sized avatar

Carter Tazio Schonwald cartazio

View GitHub Profile
@cartazio
cartazio / badsection.sh
Last active October 3, 2016 18:14
dylib testing codes; dltest.c takes a single argument thats a file path to a dylib.
#! /bin/bash
for x in {1..256}; do install_name_tool -add_rpath /$(printf '%127.127d' $x) $targetfile; done
# note .. need to replace $targetfile with either the first cli arge variable or a concrete file for this to not be
# terrible
clang
-m64
-fno-stack-protector
-DTABLES_NEXT_TO_CODE
-m64
-dynamiclib
-o
/tmp/ghc86662_0/libghc_19.dylib
dist/dist-sandbox-17656b26/build/Yesod/Auth/Routes.dyn_o
-undefined
@cartazio
cartazio / STM-FUNN.hs
Created June 11, 2016 20:28
a little demo GHCI transcript illustrating STM and concurrency
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> import Control.
Prelude> import Control.Concurrent.STM
Prelude Control.Concurrent.STM> vars <- atomically $ mapM (\ _ -> newTVar False) [1..10]
Prelude Control.Concurrent.STM> length vars
10
Prelude Control.Concurrent.STM> :t vars
vars :: [TVar Bool]
Prelude Control.Concurrent.STM> import Control.Concurrent as CC
Prelude Control.Concurrent.STM CC> CC.forkIO ( do x <- atomically (do { xs <- mapM readT } ) ; if x then putStrLn "wippeee" else putStrLn "wattt")
on the commandline: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
[ 1 of 47] Compiling System.Console.GetOpt.Utils ( src/System/Console/GetOpt/Utils.hs, dist/build/System/Console/GetOpt/Utils.o )
[ 2 of 47] Compiling System.Debian ( src/System/Debian.hs, dist/build/System/Debian.o )
[ 3 of 47] Compiling System.IO.WindowsCompat ( src/System/IO/WindowsCompat.hs, dist/build/System/IO/WindowsCompat.o )
[ 4 of 47] Compiling System.Posix.Consts ( src/System/Posix/Consts.hs, dist/build/System/Posix/Consts.o )
[ 5 of 47] Compiling System.IO.StatCompat ( src/System/IO/StatCompat.hs, dist/build/System/IO/StatCompat.o )
[ 6 of 47] Compiling System.IO.PlafCompat ( src/System/IO/PlafCompat.hs, dist/build/System/IO/PlafCompat.o )
[ 7 of 47] Compiling Data.Compression.Inflate ( src/Data/Compression/Inflate.hs, dist/build/Data/Compression/Inflate.o )
{-# LANGUAGE GADTs, RankNTypes #-}
main = putStrLn "hello!"
-- StreamModel is what we ordinarily write as "Stream" in haskell,
-- though is not ideal for a variety of reasons.
data StreamModel a = StreamModel { head :: a , tail :: StreamModel a}
data StreamTag a {- param list -} res {- result type! -} where
HeadTag :: StreamTag a a
TailTag :: StreamTag a (Stream a)
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable,DeriveAnyClass #-}
-- {-# LANGUAGE StandaloneDeriving #-}
-- {-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE KindSignatures #-}
-- {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable,DeriveAnyClass #-}
-- {-# LANGUAGE StandaloneDeriving #-}
-- {-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE KindSignatures #-}
-- {-# LANGUAGE DeriveGeneric #-}
--{-# LANGUAGE UndecidableInstances #-}
./machines.cabal has been changed. Re-configuring with most recently used
options. If this fails, please run configure manually.
Resolving dependencies...
Configuring machines-0.6.1...
Preprocessing library machines-0.6.1...
Preprocessing benchmark 'benchmarks' for machines-0.6.1...
[1 of 3] Compiling ConduitLame ( benchmarks/ConduitLame.hs, dist/build/benchmarks/benchmarks-tmp/ConduitLame.o )
[2 of 3] Compiling CriterionLame ( benchmarks/CriterionLame.hs, dist/build/benchmarks/benchmarks-tmp/CriterionLame.o )
[3 of 3] Compiling Main ( benchmarks/Benchmarks.hs, dist/build/benchmarks/benchmarks-tmp/Main.o )
Linking dist/build/benchmarks/benchmarks ...
@cartazio
cartazio / ghc-8.0-mac-build-steps.md
Last active July 5, 2019 04:26
ghc build directions

directions to do a release quality build of GHC == 8.0.* with the Make based build system with all the docs

context: this is a draft for planned edits / cleanups to the current mac build directions

getting setup

  1. have apple command line tools installed, as well as mactex, and your favorite OS X package manager (which for the rest of these directions we assume is brew)

  2. since we assume we're using brew, install it!

{-# LANGUAGE TypeInType #-}
module Main where
main = putStrLn "this compiles... not really"
{-
ignore relevance / linearity for now
-}
data IndexDesc (i :: Type) :: Type where
Pi :: (s :: Type) -> (s |--> IndexDesc i) -> IndexDesc i