Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yuga
yuga / ExplicitMin.hs
Created January 16, 2012 09:28
PFDS Exercise 3.7
module ExplicitMin (ExplicitMin) where
import Heap
data (Heap h) => ExplicitMin h a = E
| NE a (h a)
deriving (Show)
instance (Heap h) => Heap (ExplicitMin h) where
empty = E
@yuga
yuga / ghc-mod-mod.sh
Created February 13, 2012 22:24
shell wrapper for emacs on cygwin, use this instead of 'ghc-mod'
#!/bin/sh
exec "$0"/../ghc-mod ${1+"$@"} | dos2unix
@yuga
yuga / gist:1873379
Created February 21, 2012 03:18
ghc-mod-1.10.8 installation issue
$ cab install ghc-mod
Resolving dependencies...
Downloading ghc-mod-1.10.8...
Configuring ghc-mod-1.10.8...
Preprocessing executables for ghc-mod-1.10.8...
Building ghc-mod-1.10.8...
[ 1 of 16] Compiling GHCChoice ( GHCChoice.hs, dist\build\ghc-mod\ghc-mod-tmp\GHCChoice.o )
[ 2 of 16] Compiling Gap ( Gap.hs, dist\build\ghc-mod\ghc-mod-tmp\Gap.o )
[ 3 of 16] Compiling ErrMsg ( ErrMsg.hs, dist\build\ghc-mod\ghc-mod-tmp\ErrMsg.o )
[ 4 of 16] Compiling Types ( Types.hs, dist\build\ghc-mod\ghc-mod-tmp\Types.o )
@yuga
yuga / realTimeDeque.ml
Created August 6, 2012 05:25
An implementation of Real-Time Deques in PFDS (Chapter 8.4.3)
module type ITEM =
sig
type t
val print : t -> unit
end
module type ORDERED =
sig
include ITEM
@yuga
yuga / hsc2hs-ghc-7.4.1.patch
Created August 20, 2012 05:57
Quick Fix to solve runProcess error of hsc2hs
diff -Naru hsc2hs-ghc-7.4.1/utils/hsc2hs/Common.hs hsc2hs-ghc-7.4.1-fixed/utils/hsc2hs/Common.hs
--- hsc2hs-ghc-7.4.1/utils/hsc2hs/Common.hs 2012-02-02 03:10:32.000000000 +0900
+++ hsc2hs-ghc-7.4.1-fixed/utils/hsc2hs/Common.hs 2012-08-20 12:30:18.350942900 +0900
@@ -24,7 +24,11 @@
splitName :: String -> (String, String)
splitName name =
+#if defined(mingw32_HOST_OS)
+ case break (== '\\') name of
+#else
@yuga
yuga / gist:3522778
Created August 30, 2012 05:28
Data.Binary.Strict.BitGet starts to read bit from the position having the greatest value of a byte.
$ ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Data.Binary.Strict.BitGet
Prelude Data.Binary.Strict.BitGet> import Data.ByteString
Prelude Data.Binary.Strict.BitGet Data.ByteString> let a = pack [0x80,0x00]
Loading package bytestring-0.9.2.1 ... linking ... done.
Prelude Data.Binary.Strict.BitGet Data.ByteString> let r = runBitGet a $ getBit
@yuga
yuga / ex0910_LazyBinaryRandomAccessList.ml
Created September 30, 2012 00:59
a solution to Exercise 9.10 of "Purely Functional Data Structures (PFDS)"
(* a solution to Exercise 9.10 of "Purely Functional Data Structures (PFDS)" *)
module type ITEM =
sig
type t
val print : t -> unit
end
module Int : (ITEM with type t = int) =
struct
@yuga
yuga / ex0901_BinaryRandomAccessList.ml
Created September 30, 2012 15:19
a solution to Exercise 9.1 of "Purely Functional Data Structures (PFDS)"
(* a solution to Exercise 9.1 of "Purely Functional Data Structures (PFDS)" *)
module type ITEM =
sig
type t
val print : t -> unit
end
module Int : (ITEM with type t = int) =
struct
@yuga
yuga / gist:3909984
Created October 18, 2012 05:19
GHCがpinned objectをどのようにGCで回収するか

山本和彦 ?@kazu_yamamoto 教えて詳しい人:GHC では ByteString が pinned object なんですが、どうやって GC に回収されるんでしょうか?

詳しくはないけど、ざっと追いかけてみる。

GHC 7.4.1 rts/sm/Storage.c:743

// If we don't have a block of pinned objects yet, or the current

// one isn't large enough to hold the new object, allocate a new one.

@yuga
yuga / gist:4087259
Created November 16, 2012 13:13
Windowsでregex-pcre-builtinのビルドに失敗するときの対処法

Windowsでregex-pcre-builtinのビルドに失敗するときの対処法

Windowsにpandocをインストールするとかするとはまります。

依存関係: pandoc -> highlighting-kate -> regex-pcre-builtin

regex-pcre-builtin-0.94.4.1.8.31 用の手順です。

エラー事象