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
$> cat > foo.hs | |
{-# RULES "foo/Integer" foo = intFoo #-} | |
foo :: Num a => a -> a -> a | |
foo = (+) | |
intFoo = (-) | |
main = (putStrLn . show) ((foo (1::Integer) (1::Integer))::Integer) | |
$> ghc --make -O -ddump-rules -ddump-simpl-stats foo.hs |
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
module Main where | |
import Control.Parallel | |
import Control.Parallel.Strategies | |
foo = map (id) [1..10000] `using` parListChunk 400 rdeepseq |
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
type Square = Square' Nil | |
data Square' t a = Zero (t (t a)) | Succ (Square' (Cons t) a) | |
data Nil a = Nil deriving Show | |
data Cons t a = Cons a (t a) deriving Show | |
mapNil :: (a -> b) -> Nil a -> Nil b | |
mapNil _ _ = Nil | |
mapCons :: ((a -> b) -> (t a -> t b)) | |
-> (a -> b) |
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
renderPixel :: Int -> Int -> Int -> RayMaker -> World -> Colour Int | |
-- | |
parMap rdeepseq | |
(\(i,j) -> renderPixel depth i j raymaker world) | |
[(i,j) | i <- [0..h-1], j <- [0..w-1]] | |
-- | |
$> +RTS -N2 -s -RTS ... => 100% cpu usage; | |
---- |
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
pixels = concat | |
[[renderPixel depth i j raymaker world | i <- [0..(h `div` 2 - 1)], j <- [0..w-1]] `using` parListChunk (w*h `div` 4) rdeepseq | |
,[renderPixel depth i j raymaker world | i <- [(h `div` 2)..h-1], j <- [0..w-1]]] `using` parListChunk (w*h `div` 4) rdeepseq | |
`using` parListChunk (w*h `div` 4) rdeepseq |
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
solveQuadratic :: Double -> Double -> Double -> Intersections | |
solveQuadratic a b c = | |
case compare discr 0.0 of | |
LT -> [] | |
EQ -> [-b / (2 * a)] | |
GT -> [abc (-), abc (+)] | |
where discr = b ^ 2 - 4 * a * c | |
abc op = (-b `op` sqrt discr) / (2 * a) | |
-- vs |
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
Thu Apr 1 18:31 2010 Time and Allocation Profiling Report (Final) | |
raytrace +RTS -P -hc -RTS tests/Input/gml/references/testall.gml | |
total time = 175.26 secs (8763 ticks @ 20 ms) | |
total alloc = 34,673,331,808 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc ticks bytes | |
intervals'_ayp1 Base.Shape.Cylinder 22.0 17.9 1926 1552298191 |
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
Fri Apr 2 22:59 2010 Time and Allocation Profiling Report (Final) | |
raytrace +RTS -P -hc -RTS tests/Input/gml/references/testall.gml | |
total time = 133.14 secs (6657 ticks @ 20 ms) | |
total alloc = 34,741,677,700 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc ticks bytes | |
intervals'_ayaN Base.Shape.Cylinder 19.7 17.9 1313 1552298191 |
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
data Zero = Zero | |
data Succ a = Succ a | |
class Times x y z | x y -> z where | |
times :: x -> y -> z | |
instance Times Zero x Zero where | |
times Zero x = Zero | |
instance (Times n x r', Add x r' r) => Times (Succ n) x r where |
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
DSN: pgsql://klantenlogin:*password with a dot*@unix(/var/run/postgresql)/bink_klantenlogin_ng | |
-> | |
doctrine-version: 1.2.2 | |
error: | |
PDO Connection Error: SQLSTATE[08006] [7] could not translate host name "unix(" to address: Name or service not known | |
OlderNewer