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
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 |
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
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) |
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
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 |
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
(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))) |
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
#!/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/; |
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
-- 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 |
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
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 |
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
oc :: IO SQLiteHandle | |
oc = openConnection "data.rsd" | |
cc :: SQLiteHandle -> IO () | |
cc x = closeConnection x | |
-- | |
-- "table" <<++ [("column","value")] | |
-- Whee! | |
-- |
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
-- | |
-- (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 |
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
-- | |
-- 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. |