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 Prelude hiding (exp) | |
import Data.Char | |
import Text.ParserCombinators.ReadP | |
data Exp = Plus Exp Exp | |
| Pow Exp Exp | |
| Num Int | |
deriving (Show) |
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
-- | |
-- Skeleton for Salsa interpreter | |
-- To be used at the exam for Advanced Programming, B1-2013 | |
-- | |
module SalsaInterp | |
-- (Position, interpolate, runProg) | |
where | |
import SalsaAst |
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 AST where | |
type Program = [Command] | |
data Command = Command Expr [Expr] | |
data Expr = Str Ident | |
| Num Integer | |
| List [Expr] | |
type Ident = String |
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
foo :: IO (Maybe Socket) -> IO () -> IO (Maybe Socket) | |
foo sock action = do | |
actionHandler <- tryIOError action | |
return $ either (\err -> Nothing) (\sock' -> sock <|> Just sock') actionHandler | |
performSocketAction2 :: Socket -> IO () -> IO (Maybe Socket) | |
performSocketAction2 sock action = foo (Just sock) action | |
makeSocket :: IO (Socket) -> IO (Maybe Socket) |
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
$.ajax({ url: "foo.csv", dataType: "text" }) | |
.done(function(data) { | |
fetchPostTags(data); | |
$.ajax({ url: "bar.csv", dataType: "text" }) | |
.done(fetchPostsComments); | |
.fail(function(failure) { | |
updateStatus("Failed to load posts-comments.csv"); | |
console.log(failure); | |
}); |
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 TupleSections #-} | |
import Data.Char | |
import Control.Monad | |
import Control.Applicative hiding (many) | |
import Text.ParserCombinators.ReadP | |
import Test.QuickCheck | |
data Exp = Add Exp Exp | |
| Sub Exp Exp |
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
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. | |
# User-specific files | |
*.suo | |
*.user | |
*.sln.docstates | |
# Build results | |
[Dd]ebug/ |
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
let ghciEscape arg = "'" ++ concatMap (\c -> if c == '\'' then "'\"'\"'" else [c]) arg ++ "'" | |
:def! hoogle return . (":! hoogle --color --count=20 " ++) . ghciEscape | |
:def! doc return . (":! hoogle --color --info " ++) . ghciEscape | |
:set prompt "\ESC[1;34m%s\n\ESC[0;34mλ> \ESC[m" |
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.Char | |
import Control.Monad | |
import Control.Applicative | |
para :: (a -> b -> [a] -> b) -> b -> [a] -> b | |
para f e [] = e | |
para f e (x:xs) = para f (f x e xs) xs | |
main = 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
using (WebClient webClient = new WebClient()) | |
{ | |
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); | |
byte[] request = System.Text.Encoding.UTF8.GetBytes("payload=" + JsonConvert.SerializeObject(message)); | |
byte[] response = webClient.UploadData(this._webHookUri, "POST", request); | |
} |