Skip to content

Instantly share code, notes, and snippets.

View mtolly's full-sized avatar

Michael Tolly mtolly

View GitHub Profile
@mtolly
mtolly / A.hs
Created July 15, 2015 18:06
Sample Haskell project using embedded Ruby as a preprocessor
module A where
@mtolly
mtolly / Adder.hs
Created July 29, 2015 01:22
Small example of compiling a Haskell Mac .dylib to be used from C
{-# LANGUAGE ForeignFunctionInterface #-}
module Adder where
import Foreign.C
adder :: CInt -> CInt -> IO CInt
adder x y = return $ x + y
foreign export ccall adder :: CInt -> CInt -> IO CInt
@mtolly
mtolly / mac-libgdiplus.sh
Last active March 4, 2025 07:57
How to build and install the Mono libgdiplus.dll on a Mac with Homebrew (update: no longer needed, see comments)
#!/bin/bash
# First install XQuartz, then...
brew install freetype fontconfig libpng
ln -s /opt/X11/include/X11 /usr/local/include/X11
git clone [email protected]:mono/libgdiplus
cd libgdiplus
./autogen.sh
make install
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Control.Monad.Trans.Writer
import Data.String (IsString (..))
newtype ListBuilder e a = ListBuilder { runListBuilder :: Writer [e] a }
deriving (Functor, Applicative, Monad)