Skip to content

Instantly share code, notes, and snippets.

View cmoore's full-sized avatar
🆑

Clint Moore cmoore

🆑
View GitHub Profile
p9_is_correct :: Int -> Int -> Int -> Bool
p9_is_correct x y z =
x^2 + y^2 == z^2 &&
x + y + z == 1000 &&
x < y && y < z
p9_fix :: Int -> Int -> ( Int, Int )
p9_fix x y =
case ( x > y || x == y ) of
True ->
let y' = x + 1
in
(x,y')
False ->
(x,y)
module Doc where
import Control.Monad
import System.Directory
qualify :: FilePath -> IO String
qualify x = liftM (\y ->
y ++ "/.cabal/share/doc/" ++ x ++ "/html/doc-index.html"
) getHomeDirectory
(add-to-list 'load-path "~/emacs/haskell")
(load "~/emacs/haskell/haskell-site-file" )
(require 'inf-haskell)
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(setq haskell-program-name "ghci")
(defun flymake-get-Haskell-cmdline (source base-dir)
(list "flycheck_haskell.pl"
(list source base-dir)))
#!/usr/bin/env perl
#
$ghc = '/usr/bin/ghc'; # where is ghc
@ghc_options = (); # e.g. ('-fglasgow-exts')
@ghc_packages = (); # e.g. ('QuickCheck')
### the following should not been edited ###
use File::Temp qw /tempfile tempdir/;
-- Utils
conn :: IO Server
conn = Single.connect "192.168.0.33" 1111
dconn x = Single.disconnect x
m_set :: Server -> String -> String -> IO Bool
m_set ss x y = do
Network.Memcache.set ss x y
key_from_row :: String -> [(String,String)] -> String
key_from_row key (row:x) = do
let (k,v) = row
if k == key then v else key_from_row key x
oc :: IO SQLiteHandle
oc = openConnection "data.rsd"
cc :: SQLiteHandle -> IO ()
cc x = closeConnection x
--
-- "table" <<++ [("column","value")]
-- Whee!
--
--
-- (env .> "first_name") = the post-ed field "first_name"
--
(.>) :: Env -> String -> String
(.>) env k =
case requestMethod env of
POST ->
do
let ( posts, _ ) = parsePost ctype clen $ hackInput env
fromMaybe "" $ lookup k posts
--
-- bt spits out a template without any options parsing.
--
bt :: String -> IO Response
bt x = do
templates <- directoryGroup "templates"
return $ def { body = pack $ renderTemplateGroup templates ([]::[(String,String)]) x, status = 200 }
--
-- btt gives a template with the provides options subtituted.