Skip to content

Instantly share code, notes, and snippets.

View bshepherdson's full-sized avatar

Braden Shepherdson bshepherdson

  • Metabase
  • Godfrey, ON, Canada
View GitHub Profile
@bshepherdson
bshepherdson / gist:6186057
Created August 8, 2013 16:14
Error message for the GHCJS-built version of Hork
vagrant@precise32:/vagrant/hork$ node hork.jsexe/all.js Zork1.z3
/vagrant/hork/hork.jsexe/all.js:12423
buf.setUint32(off, f.buf.len);
^
TypeError: Object #<Object> has no method 'setUint32'
at h$__hscore_fstat (/vagrant/hork/hork.jsexe/all.js:12423:7)
at h$_baseZCSystemziPosixziInternalszisat_e_jJcgKT (/vagrant/hork/hork.jsexe/all.js:111935:11)
at h$mainLoop (/vagrant/hork/hork.jsexe/all.js:14284:13)
at h$startMainLoop (/vagrant/hork/hork.jsexe/all.js:14238:5)
@bshepherdson
bshepherdson / gist:6187696
Created August 8, 2013 19:08
`vagrant up` run for master ghcjs that failed
> vagrant up ~/src/ghcjs/scratch
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
@bshepherdson
bshepherdson / gist:6241233
Created August 15, 2013 14:25
Errors build GHCJS vagrant VM
err: /Stage[main]//Exec[build0]/returns: change from notrun to 0 failed: /home/vagrant/stage0_ghc.sh returned 1 instead of one of [0] at /tmp/vagrant-puppet/manifests/base.pp:126
notice: /Stage[main]//Exec[build0]/returns: ====================================
notice: /Stage[main]//Exec[build0]/returns: Copy the ghc-build-refs into place
notice: /Stage[main]//Exec[build0]/returns: ====================================
notice: /Stage[main]//Exec[build0]/returns: cp: target `ghc-source/utils/' is not a directory
err: /Stage[main]//Exec[build0]: Failed to call refresh: /home/vagrant/stage0_ghc.sh returned 1 instead of one of [0] at /tmp/vagrant-puppet/manifests/base.pp:126
notice: /Stage[main]//Exec[build1]: Dependency Exec[build0] has failures: true
warning: /Stage[main]//Exec[build1]: Skipping because of failed dependencies
notice: /Stage[main]//Exec[build1]: Triggered 'refresh' from 1 events
info: /Stage[main]//Exec[build1]: Scheduling refresh of Exec[build2]
@bshepherdson
bshepherdson / gist:6243355
Created August 15, 2013 18:24
Error installing test-framework in GHCJS VM
[22 of 23] Compiling Test.Framework.Runners.Console ( Test/Framework/Runners/Console.hs, dist/build/Test/Framework/Runners/Console.o )
Test/Framework/Runners/Console.hs:26:10:
Duplicate instance declarations:
instance Functor OptDescr
-- Defined at Test/Framework/Runners/Console.hs:26:10
instance [safe] Functor OptDescr
-- Defined in ‛System.Console.GetOpt’
Test/Framework/Runners/Console.hs:29:10:
@bshepherdson
bshepherdson / gist:6286288
Created August 20, 2013 19:48
Errors with lenses
SNES/CPU.hs:1963:48:
No instance for (Applicative
(Control.Lens.Internal.Context.Pretext (->) Word8 Word8))
arising from a use of `traversed'
Possible fix:
add an instance declaration for
(Applicative
(Control.Lens.Internal.Context.Pretext (->) Word8 Word8))
In the first argument of `(.)', namely `traversed'
In the second argument of `(.)', namely
@bshepherdson
bshepherdson / CPU.hs
Created August 20, 2013 20:11
Complete code for the CPU
{-# LANGUAGE GeneralizedNewtypeDeriving, BangPatterns, TemplateHaskell, ExistentialQuantification, MultiParamTypeClasses, FunctionalDependencies #-}
module SNES.CPU where
-- An emulator for the 65c816 processor of the SNES.
-- This is a 16-bit processor slightly customized for use in the SNES.
-- Reference material: docs/cpu, http://www.westerndesigncenter.com/wdc/datasheets/Programmanual.pdf
-- NB: double-byte storage is done little-endian.
--
class _KDNode[A: Any val]
let point : Array[A] val
let depth : USize val
let v : A
var left : (_KDNode[A] | None) = None
var right : (_KDNode[A] | None) = None
new create(p : Array[A] val, d : USize val) =>
point = p
depth = d
fun _read_json_file(f: File) : JsonDoc val ? =>
let bytes : Array[U8] val = f.read(f.size())
recover val
var json = JsonDoc.create()
let s : String val = recover val
var r : String ref = String()
r.append(bytes)
end
json.parse(s)
@bshepherdson
bshepherdson / parser.pony
Created March 21, 2016 00:02
Generics trouble in Pony
interface ParseBuffer
fun peek(): U8 ?
fun ref head(): U8 ?
fun eof(): Bool
fun clone(): ParseBuffer
class _StringBuffer is ParseBuffer
let _str: String val
var _pos: USize
interface ParseBuffer
fun peek(): U8 ?
fun ref head(): U8 ?
fun eof(): Bool
fun clone(): ParseBuffer
fun ref reset(ParseBuffer) ?