Skip to content

Instantly share code, notes, and snippets.

View serras's full-sized avatar

Alejandro Serrano serras

View GitHub Profile
@serras
serras / SaberYGanar.hs
Created April 6, 2012 14:21
Saber y Ganar
{-# LANGUAGE ScopedTypeVariables #-}
module SaberYGanar where
-- un programa presentado por Alejandro Serrano
import Control.Monad.Random
-- import Control.Monad.Random.Class
-- Posibles operaciones del juego
data Operacion = Mas Int
| Menos Int
@serras
serras / purrs.rb
Created September 20, 2012 12:47
Homebrew formula for Purrs
require 'formula'
class Purrs < Formula
homepage ''
url "cvs://:pserver:anoncvs@cvs.cs.unipr.it:/cvs/purrs:purrs", :using => :cvs
version '0.0.3'
depends_on :x11
depends_on 'automake'
depends_on 'autoconf'
@serras
serras / ciaopp-purrs-install.md
Last active October 10, 2015 21:48
Install Ciao and Purrs on Mac OS X 1.7

Preparing the environment

To install everything in an automated fashion, we will use Homebrew, which is a package manager for Mac OS X:

  • Go to Apple Developers Page (you may need to register),
  • Download the XCode Command Line Tools and XQuartz and install them,
  • Open a terminal,
  • Execute ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go).
@serras
serras / gcc.rb
Last active October 10, 2015 21:48
GCC 4.7 with Multilib
require 'formula'
# NOTE: GCC 4.6.0 adds the gccgo compiler for the Go language. However,
# gccgo "is currently known to work on GNU/Linux and RTEMS. Solaris support
# is in progress. It may or may not work on other platforms."
class Gcc47 < Formula
homepage 'http://gcc.gnu.org'
url 'http://ftpmirror.gnu.org/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2'
mirror 'http://ftp.gnu.org/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2'
require 'formula'
class Ppl < Formula
homepage 'http://bugseng.com/products/ppl/'
url 'http://bugseng.com/products/ppl/download/ftp/releases/1.0/ppl-1.0.tar.gz'
sha1 '5f543206cc9de17d48ff797e977547b61b40ab2c'
depends_on 'gmp'
def install
require 'formula'
class Libmpc < Formula
homepage 'http://multiprecision.org'
url 'http://multiprecision.org/mpc/download/mpc-1.0.1.tar.gz'
sha1 '8c7e19ad0dd9b3b5cc652273403423d6cf0c5edf'
bottle do
cellar :any
sha1 'c8bbad14fa8314418e07aa7a5cd824452fa6ea1e' => :mountain_lion
@serras
serras / mpfr.rb
Last active December 16, 2015 08:19
require 'formula'
class Mpfr < Formula
homepage 'http://www.mpfr.org/'
# Upstream is down a lot, so use the GNU mirror + Gist for patches
url 'http://ftpmirror.gnu.org/mpfr/mpfr-3.1.2.tar.bz2'
mirror 'http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.bz2'
sha1 '46d5a11a59a4e31f74f73dd70c5d57a59de2d0b4'
bottle do
require 'formula'
class Gmp < Formula
homepage 'http://gmplib.org/'
url 'ftp://ftp.gmplib.org/pub/gmp-5.1.1/gmp-5.1.1.tar.bz2'
mirror 'http://ftp.gnu.org/gnu/gmp/gmp-5.1.1.tar.bz2'
sha1 '21d037f7fb32ae305a2e4157cff0c8caab06fe84'
bottle do
cellar :any
@serras
serras / nested_lists.hs
Created April 5, 2014 10:25
Nested nested lists in Haskell
{-# LANGUAGE TypeFamilies, DataKinds, GADTs #-}
-- Wrap the doll one level.
matryoshka :: a -> [a]
matryoshka x = [x]
-- The type of unary natural numbers.
-- With the help of 'DataKinds' extension, we get a corresponding
-- 'Nat' type which we can use to index the 'NestedList' type.
data Nat = Zero | Succ Nat
type family All (c :: k -> Constraint) (t :: [k]) :: Constraint where
All c '[] = ()
All c (x ': xs) = (c x, All c xs)