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
localSession = do | |
h <- oc | |
res <- (execStatement h "SELECT session from facebook limit 1") :: IO (Either String [[Row String]]) | |
cc h | |
case res of | |
Right [[[(_,xx)]]] -> return xx | |
_ -> return "-1" | |
{- | |
How can I condense this? I can tell that I will probably need to do {} the case |
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 Main where | |
import Text.Printf | |
import Control.Monad | |
fib :: Int -> Int | |
fib 0 = 0 | |
fib 1 = 1 | |
fib n = fib (n-1) + fib (n-2) | |
main = forM_ [0..45] $ \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
module Main where | |
import Text.Printf | |
import Control.Monad | |
import Control.Parallel | |
fib :: Int -> Int | |
fib 0 = 0 | |
fib 1 = 1 | |
fib n = r `par` (l `pseq` l+r) | |
where |
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 Control.Parallel | |
import Control.Monad | |
import Text.Printf | |
cutoff = 35 | |
fib' :: Int -> Integer | |
fib' 0 = 0 | |
fib' 1 = 1 | |
fib' n = fib' (n-1) + fib' (n-2) |
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
for f in `cabal list | grep \* | cut -f 2 -d \ `; do cabal fetch $f; done |
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
{- Types.hs -} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
module Brazil.Types where | |
import Data.Typeable () | |
import Data.Generics | |
import Text.StringTemplate.GenericStandard () |
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
{- No, it's not live. Just testing. :) -} | |
{-# LANGUAGE ViewPatterns #-} | |
galleryDispatch ai@(\x -> head (pElements x) -> "u") = | |
case requestMethod (a_env ai) of | |
POST -> do | |
let env = a_env ai -- Hack's Env | |
case ((,) <$> lookup "Content-Type" (http env) | |
<*> lookup "Content-Length" (http env)) of | |
Nothing -> do |
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 Hack | |
import qualified Web.Encodings as Web | |
galleryDispatch ai@(\x -> head (pElements x) -> "u") = | |
case requestMethod (a_env ai) of | |
POST -> do | |
dbg "galleryDispatch: POST on /upload." | |
let env = a_env ai | |
case ((,) <$> lookup "Content-Type" (http env) | |
<*> lookup "Content-Length" (http env)) of |
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
galleryDispatch ai@(\x -> head (pElements x) -> "u") = | |
case requestMethod (a_env ai) of | |
POST -> do | |
dbg "galleryDispatch: POST on /upload." | |
let env = a_env ai | |
case ((,) <$> lookup "Content-Type" (http env) | |
<*> lookup "Content-Length" (http env)) of | |
Nothing -> do | |
dbg "Ack!" | |
redirect' "/profile" |
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 Hack | |
import qualified Web.Encodings as Web | |
import Data.ByteString.Lazy.Char8 as BS | |
galleryDispatch ai@(\x -> head (pElements x) -> "u") = | |
case requestMethod (a_env ai) of | |
POST -> do | |
dbg "galleryDispatch: POST on /upload." | |
let env = a_env ai | |
case ((,) <$> lookup "Content-Type" (http env) |