This file contains 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
int main(void) | |
{ | |
return 0; | |
} |
This file contains 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
-- Single value must be Monad. | |
-- Akira Hayakawa, 2011 | |
import Control.Applicative | |
import Control.Monad | |
data Single a = Single a deriving (Eq, Show, Ord) | |
instance Functor Single where | |
-- fmap :: (a->b) -> Single a -> Single b |
This file contains 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
newtype While a = While { get :: (a, Bool) } | |
instance Functor While where | |
fmap f (While (a, True)) = let (a', b) = f a in While (a', b) | |
fmap _ (While (a, False)) = While (a, False) | |
countDown :: Int -> (Int, Bool) | |
countDown i = | |
let i' = i - 1 | |
in |
This file contains 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
Prelude Control.Applicative> let x = (++) <$> getLine <*> getLine | |
Prelude Control.Applicative> x | |
akira | |
developer | |
"akiradeveloper" |
This file contains 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
-- Still under development but I will show you my code. | |
-- Haskell is beautiful. | |
import Control.Monad | |
import Data.List | |
type Elem = (Int, Int) | |
-- Either Monad is not defined yet in ghc of 6.x | |
instance Monad (Either a) where |
This file contains 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.Monad | |
import Data.List | |
type Elem = (Int, Int) | |
-- Either Monad is not defined yet in ghc of 6.x | |
instance Monad (Either a) where | |
Right a >>= f = f a | |
Left a >>= _ = Left a | |
return = Right |
This file contains 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 f x = x;; | |
val f : 'a -> 'a = <fun> | |
# ^[[A |
This file contains 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
# Example of tag diff copy | |
$ cat file_a | |
unko | |
#START_TAG_DIFF_COPY mydiff | |
hoge | |
hage | |
hige | |
#END_TAG_DIFF_COPY | |
chinko |
This file contains 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
class SSHServer | |
def accept?(client) | |
authorized_keys.each do |public_key| | |
return true if client.has?( private_key_of(public_key) ) | |
end | |
return false unless permit_password_authentification | |
return true if client.respond(password) | |
return false | |
end | |
end |
This file contains 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
zshpath=`which zsh` | |
if [ $? -ne 0 ] | |
then | |
exit | |
fi | |
if [ $SHELL = $zshpath ] | |
then | |
exit | |
fi |
OlderNewer