Skip to content

Instantly share code, notes, and snippets.

@hdgarrood
hdgarrood / simplex.py
Last active May 16, 2017
An extremely naive implementation of the simplex algorithm.
View simplex.py
from collections import namedtuple
import numpy as np
# This is an implementation of the version of the simplex algorithm we are
# expected to execute by hand in LPMS. There is just one important difference:
# because python and numpy use zero-based indexing, this does too. So for
# example you need to subtract 1 from each element of your basic and nonbasic
# sets.
LPState = namedtuple("LPState", ["basic", "nonbasic"])
View large-haskell-projects-on-travis.md

Haskell projects with lots of dependencies on Travis CI

If your Haskell project has lots of dependencies, you can find yourself reaching the timeout while compiling them - the free service has a timeout of 50 minutes. How do we address this?

First, a quick reminder of build statuses in Travis CI:

All builds finish with one of four possible statuses: succeeded, failed, errored, or (manually) cancelled. The difference between a failed and errored

View awkward-records.patch
a9d20f4 Add test for generic deriving with awkward records (Harry Garrood, 54 seconds ago)
diff --git a/examples/passing/RecordLabels.purs b/examples/passing/RecordLabels.purs
new file mode 100644
index 0000000..b58a4bd
--- /dev/null
+++ b/examples/passing/RecordLabels.purs
@@ -0,0 +1,5 @@
+module Main where
+
View PureScript-On-Docker.md

Dependencies

First you'll need a docker install: https://docs.docker.com/installation/

psci

After installing Docker, we'll run a PureScript psci session by running the 0.6.1.1 image. The -it flags allocate a pseudo tty and make it interactive. We're pulling the image from the default docker hub, so the images are here and the code that builds them is on GitHub

docker run -it biscarch/purescript:0.6.1.1
View Main.purs
module Main where
import
Prelude
Data.List (List)
Data.List as List
Control.Monad as Monad
Control.Monad.Eff.Console as Console
main = Console.log (show "hello world")
View Main.purs
module Main where
import Prelude
import Data.Either
import Data.Functor.Compose
import Control.Monad.Eff.Console (print)
class Convert a b where
convert :: a -> b
View Main.purs
module Main where
import Prelude
import Data.Maybe (Maybe)
import Data.List (List)
import Control.Monad.Eff.Console (print)
import Control.Comonad.Cofree (Cofree, mkCofree, head, tail)
import Control.Alternative (class Alternative)
import Control.Plus (empty)
View needs-reupload.md

The following packages use operator aliases and appear to have been generated with version 0.8.0 of the compiler. Since the encoding for operator aliases changed in 0.8.1, these need to be regenerated:

  • flare 0.4.3
  • flare 0.5.0
  • difflists 3.0.1-pursuit
  • difflists 3.0.1
  • neon 0.4.0
  • neon 0.4.1
  • nonempty 0.2.0
  • rationals 0.3.1
@hdgarrood
hdgarrood / Main.purs
Last active Feb 16, 2016
`*>` is not `flip <*`!
View Main.purs
module Main where
import Prelude
import Data.Monoid
import Control.Apply as Apply
import Control.Monad.Writer
import Control.Monad.Eff.Console (log, print)
main = do
print (runWriter (f "hi" Apply.<* f " world"))
View missing.txt
purescript-aff 0.11.0
purescript-batteries 0.2.2
purescript-batteries 0.2.3
purescript-batteries 0.2.4
purescript-batteries 0.2.5
purescript-batteries 0.3.0
purescript-batteries 0.4.0
purescript-batteries 0.5.0
purescript-batteries 0.5.1
purescript-behaviors 0.1.0