This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Relaxation labelling in Haskell | |
-- Usage: Load it in ghci, type `step 2` for 2 iterations. | |
import Data.List.Split (chunksOf) | |
import Text.Printf (printf) | |
import qualified Data.MemoCombinators as Memo -- data-memocombinators | |
import Data.MemoCombinators (memo3) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
""" | |
Uploads haddocks to Hackage. | |
Use it when Hackage can't build your documentation (e.g. missing libraries). | |
Inspired by: | |
http://fuuzetsu.co.uk/blog/posts/2014-01-06-Fix-your-Hackage-documentation.html | |
""" | |
import getpass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
ghc -O2 -fforce-recomp ffi-overhead.hs return.c && ./ffi-overhead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 01fdec9..24584e0 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -300,7 +300,8 @@ find_package(Qhull) | |
include("${PCL_SOURCE_DIR}/cmake/pcl_find_cuda.cmake") | |
# Find Qt5 | |
-include(cmake/pcl_find_qt5.cmake) | |
+# nh2: Use Qt4 instead due to https://github.com/PointCloudLibrary/pcl/issues/477 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Does realToFrac compile to a no-op for (CFloat <-> Float / CDouble <-> Double)? | |
(14:27:30) kosmikus: nh2: it'll be a noop in many situations. CDouble normally is a newtype wrapper around Double. There are GHC Rule pragmas that'll turn realToFrac between Double and CDouble into a realToFrac between Double and Double by applying the constructor. Applying the constructor is a no-op, and there's a Double/Double instance having id as implementation. | |
(14:28:17) kosmikus: nh2: that being said, it's known that while simple applications of newtype constructors are newtypes, that doesn't translate to all contexts (such as mapping the constructor over a datastructure, for example) | |
(14:28:55) FreeFull: kosmikus: realToFrac isn't part of a typeclass though, it is defined as realToFrac = fromRational . toRational | |
(14:30:37) kosmikus: FreeFull: hm, you're right, I've been looking at the wrong place. let's check again. | |
(14:32:38) nh2: kosmikus, FreeFull: I really hope that realToFrac has rewrite rules for Double/CDouble and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables, BangPatterns #-} | |
-- Example of how forM_ [1..N] is slow | |
module Main (main) where | |
import Prelude hiding (read) | |
import Control.Monad | |
import Data.Vector ((!), Vector) | |
import qualified Data.Vector as V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-} | |
newtype TimeUnit = TimeUnit Integer -- how many microseconds | |
deriving (Eq, Show, Num) | |
instance Num (TimeUnit -> TimeUnit) where | |
fromInteger n = \(TimeUnit scale) -> TimeUnit (n * scale) | |
-- a + b = ... -- task for you |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Creates a git repository called "testgit-generated" | |
# with two separate histories branching from the initial | |
# commit, each being 500 commits long. | |
# On top of each, we create 200 branches with one extra | |
# commit per branch. | |
# Should take around 30 seconds. | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Criterion.Main | |
import Data.List (sort) | |
import Data.Vector (Vector, fromList, unsafeThaw) | |
import qualified Data.Vector.Mutable as VM | |
import Data.Vector.Algorithms.Heap (select) | |
import Control.Monad.ST (runST) | |
import Data.Maybe (fromJust) | |
kSmallest1 :: Int -> [Int] -> Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List (sort) | |
import qualified Data.Map as Map | |
import Distribution.PackDeps | |
import Control.Monad | |
main :: IO () | |
main = do | |
newest <- loadNewest | |
let reverses = getReverses newest |