This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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 Display | |
interp :: String -> Interpreter DisplayResult | |
interp i = do | |
set [searchPath := ["."]] | |
loadModules ["*Display.hs"] | |
setTopLevelModules ["Display"] | |
interpret ("display (" ++ i ++ ")") infer |
This file contains hidden or 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
# 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. |
This file contains hidden or 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
(setq load-path (append '("~/projects/emacs/org-mode/lisp" "~/projects/emacs/org-mode/contrib/lisp") load-path)) | |
(require 'org) | |
(custom-set-faces | |
'(org-link ((t (:foreground "aqua" :underline t)))) | |
'(org-date ((t (:foreground "RoyalBlue1" :underline t))))) | |
;; IDO | |
(setq org-completion-use-ido t) |
This file contains hidden or 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 Text.XML.HXT.Core | |
doc = "/Users/dan/Downloads/greader-takeout/Reader/subscriptions.xml" | |
type Subscriptions = [(String, String)] | |
getSites :: ArrowXml a => a XmlTree (String,String) | |
getSites = isElem | |
>>> hasAttrValue "type" (=="rss") | |
>>> getAttrValue "htmlUrl" &&& getAttrValue "xmlUrl" |
This file contains hidden or 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.Functor.Compose | |
data N n = N { unN :: n Int } | |
f :: (Functor n, Functor m) => (Int -> m Int) -> N n -> N (Compose n m) | |
f h = N . Compose . fmap h . unN | |
-- f h (N x) = N $ Compose (fmap h x) |