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
/* FNV-1 hash | |
* | |
* The FNV-1 hash description: http://isthe.com/chongo/tech/comp/fnv/ | |
* The FNV-1 hash is public domain: http://isthe.com/chongo/tech/comp/fnv/#public_domain | |
long hashable_fnv_hash(const unsigned char* str, long len, long hash) { | |
while (len--) { | |
hash = (hash * 16777619) ^ *str++; | |
} |
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
> modifyMatch :: LMatch RdrName (LHsExpr RdrName) | |
> -> LMatch RdrName (LHsExpr RdrName) | |
> modifyMatch (L l1 (Match lpat lty rs@(GRHSs{..}))) = | |
> let f (L l1 (GRHS guards body)) = | |
> L l1 (GRHS guards (modifyExpr body)) | |
> in L l1 (Match lpat lty (rs | |
> { grhssGRHSs = map f grhssGRHSs })) |
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
instance (a ~ D.SVG, b ~ D.R2, c ~ Any) => Display (D.QDiagram a b c) where | |
instance Display (D.QDiagram D.SVG D.R2 Any) 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
src/Diagrams/Trail.hs:150:1: | |
Can't make a derived instance of `Transformable (SegTree v)' | |
(even with cunning newtype deriving): | |
it is not type-safe to use GeneralizedNewtypeDeriving on this class; | |
the last parameter of `Transformable' is at role N | |
In the stand-alone deriving instance for | |
`(HasLinearMap v, InnerSpace v, OrderedField (Scalar v)) => | |
Transformable (SegTree 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
match "gallery/*.lhs" $ version "gallery" $ do | |
route $ setExtension "html" | |
compile $ do | |
getResourceBody >>= saveSnapshot "rawcontent" | |
withMathJax | |
>>= loadAndApplyTemplate "templates/exampleHi.html" | |
( mconcat | |
[ field "code" readSource | |
, setImgURL | |
, setHtmlURL |
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 DeriveFunctor #-} | |
module FAlgebra where | |
-- General types | |
newtype Algebra f a = Alg { unAlg :: (f a -> a) } | |
newtype Mu f = Fix (f (Mu f)) | |
-- Dummy expression type/functor | |
data ExprF a = Const 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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Text.Hastache | |
import Web.Scotty as S | |
import Web.Scotty.Hastache | |
main :: IO () | |
main = scottyH' 3000 $ do | |
setTemplatesDir "/home/vagrant/dev/" |
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
proxy1 :: (Proxy p) => String -> Server p String Int IO () | |
proxy1 = fromListS [1..] >-> mapU (const ()) >-> useU putStrLn | |
retpmorp :: (Proxy p) => () -> p String () () C IO r | |
retpmorp () = turn $ prompter () | |
prompter :: (Proxy p) => () -> Producer p String IO r | |
prompter () = runIdentityP $ forever $ do | |
lift $ putStr "> " | |
lift $ hFlush stdout |
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
file { '/home/vagrant/stage1_cabalsrc.sh': | |
ensure => present, | |
source => "/vagrant/scripts/stage1_cabalsrc.sh", | |
owner => vagrant, | |
mode => 766 | |
} | |
~> | |
exec { 'build1': | |
provider => 'shell', | |
user => vagrant, |
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 Language.Haskell.Interpreter | |
import MyModule | |
main = do | |
r <- runInterpreter interp | |
case r of | |
Left err -> print $ show err | |
Right res -> print res | |
interp :: Interpreter IntBox |