Skip to content

Instantly share code, notes, and snippets.

@co-dan
co-dan / local.mk
Created May 23, 2013 08:48
local.mk settings for org-mode 8.x and Emacs 23 on Ubuntu
# Name of your emacs binary
EMACS = emacs
# Where local software is found
prefix = /usr/share
# Where local lisp files go.
lispdir= $(prefix)/emacs/site-lisp/org
# Where local data files go.
import Language.Haskell.Interpreter
import Display
interp :: String -> Interpreter DisplayResult
interp i = do
set [searchPath := ["."]]
loadModules ["*Display.hs"]
setTopLevelModules ["Display"]
interpret ("display (" ++ i ++ ")") infer
@co-dan
co-dan / Main.hs
Last active December 18, 2015 00:49
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
file { '/home/vagrant/stage1_cabalsrc.sh':
ensure => present,
source => "/vagrant/scripts/stage1_cabalsrc.sh",
owner => vagrant,
mode => 766
}
~>
exec { 'build1':
provider => 'shell',
user => vagrant,
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
@co-dan
co-dan / Main.hs
Last active December 19, 2015 20:49
Working on scotty-hastache
{-# 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/"
@co-dan
co-dan / FAlgebra.hs
Created August 11, 2013 12:56
F-algebras
{-# 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
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
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)'
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