Skip to content

Instantly share code, notes, and snippets.

@yuga
yuga / ExplicitMin.hs
Created Jan 16, 2012
PFDS Exercise 3.7
View ExplicitMin.hs
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 Feb 13, 2012
shell wrapper for emacs on cygwin, use this instead of 'ghc-mod'
View ghc-mod-mod.sh
#!/bin/sh
exec "$0"/../ghc-mod ${1+"$@"} | dos2unix
@yuga
yuga / gist:1873379
Created Feb 21, 2012
ghc-mod-1.10.8 installation issue
View gist:1873379
$ 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 Aug 6, 2012
An implementation of Real-Time Deques in PFDS (Chapter 8.4.3)
View realTimeDeque.ml
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 Aug 20, 2012
Quick Fix to solve runProcess error of hsc2hs
View hsc2hs-ghc-7.4.1.patch
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 Aug 30, 2012
Data.Binary.Strict.BitGet starts to read bit from the position having the greatest value of a byte.
View gist:3522778
$ 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 Sep 30, 2012
a solution to Exercise 9.10 of "Purely Functional Data Structures (PFDS)"
View ex0910_LazyBinaryRandomAccessList.ml
(* 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 Sep 30, 2012
a solution to Exercise 9.1 of "Purely Functional Data Structures (PFDS)"
View ex0901_BinaryRandomAccessList.ml
(* 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 Oct 18, 2012
GHCがpinned objectをどのようにGCで回収するか
View gist:3909984

山本和彦 ?@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 Nov 16, 2012
Windowsでregex-pcre-builtinのビルドに失敗するときの対処法
View gist:4087259

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

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

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

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

エラー事象