I hereby claim:
- I am sshine on github.
- I am sshine (https://keybase.io/sshine) on keybase.
- I have a public key ASBgprI2XryI_tASbgYfLUjHl1-zCW53t7A8TpIl7OXGvAo
To claim this, I am signing this object:
| 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) |
| module AST where | |
| type Program = [Command] | |
| data Command = Command Expr [Expr] | |
| data Expr = Str Ident | |
| | Num Integer | |
| | List [Expr] | |
| type Ident = String |
| -- | |
| -- Skeleton for Salsa interpreter | |
| -- To be used at the exam for Advanced Programming, B1-2013 | |
| -- | |
| module SalsaInterp | |
| -- (Position, interpolate, runProg) | |
| where | |
| import SalsaAst |
| import Prelude hiding (exp) | |
| import Data.Char | |
| import Text.ParserCombinators.ReadP | |
| data Exp = Plus Exp Exp | |
| | Pow Exp Exp | |
| | Num Int | |
| deriving (Show) |
| import Text.ParserCombinators.ReadP | |
| import Control.Monad | |
| import Data.Char | |
| data Exp = Add Exp Exp | |
| | Mul Exp Exp | |
| | Num Int | |
| | Dbl Double | |
| | Neg Exp |
| import Test.QuickCheck | |
| import Text.ParserCombinators.ReadP | |
| import Control.Monad | |
| import Control.Applicative hiding (Const) | |
| data Tree = Leaf Int | |
| | Branch Tree Tree | |
| deriving (Show) |
| Keyservers: | |
| A keyserver is a repository for cryptographic keys. A person can upload their | |
| keys to a keyserver, and other persons can retrieve the key if they want to | |
| send them an encrypted message. | |
| To avoid a keyserver being compromised, several keyservers can be connected | |
| and share their databases. So if one server has its keys changed, the other | |
| servers can |
| -module(transact). | |
| -export([ start_server/1, start_transaction/1, | |
| modify_state/3, commit_transaction/2 ]). | |
| %%%%%%% | |
| rpc_send(Pid, Msg) -> | |
| Pid ! {self(), Msg}, | |
| receive | |
| {reply, Reply} -> |
I hereby claim:
To claim this, I am signing this object:
| minima :: Ord a => [a] -> [a] | |
| minima [] = [] | |
| minima (y:xs) = foldr aux [y] xs | |
| where aux x result = | |
| case x `compare` head result of | |
| LT -> [x] | |
| EQ -> x:result | |
| GT -> result |