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
################################################################# | |
#並列化時代のためのFizzBuzzです~>ω< | |
#Author : 月影 | |
#Date : 2013/12/24 | |
#License : お好きにどうぞ(Public Domainというやつですー>ω<) | |
#Comment : 聖なる夜に何をやっているんでしょう……( ̄▽ ̄ll) | |
################################################################# | |
#プログラムを止める際に実行されますです~>ω< | |
#下の方で無限ループしているので、Ctrl-Cで止めてくださいです(≧∇≦)b |
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 ((.)) | |
import Control.Category | |
data Store s a = Store { | |
set' :: s -> a, view' :: s} | |
newtype Lens' b a = Lens { | |
runLens :: a -> Store b a} | |
type Lens a b = Lens' b a |
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 Rank2Types, DeriveFunctor, LambdaCase #-} | |
module Control.Monad.Free.Scott (($|), Free(..), free', pure', liftF) where | |
infixl 1 $| | |
($|) :: (a -> b) -> a -> b | |
f $| x = f x | |
-- Type | |
newtype Free f a = Free { |
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 TemplateHaskell, QuasiQuotes, FlexibleContexts #-} | |
import Text.Peggy hiding (Expr, space) | |
import Control.Monad.State | |
type Name = String | |
data Type = | |
TInt| | |
TBool| | |
TVar Name| | |
TFun Type Type deriving (Show, Eq) |
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.Monad.State | |
type Name = String | |
data Type = | |
TInt| | |
TBool| | |
TVar Name| | |
TFun Type Type deriving (Show, Eq) | |
data Expr = | |
EInt Int| |
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
-- Generalized Algebraic Data Types(一般的代数データ型)が使えるようになるみたいです>ω< | |
{-# LANGUAGE GADTs #-} | |
module Main where | |
import Prelude hiding (head, tail, map) | |
-- EmptyとNonEmptyもリストのような構造にすることで、 | |
-- あと何回tailすることが出来るのか、という情報を保持しますです>ω< | |
data Empty | |
data NonEmpty 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
import Control.Applicative ((<$>),(<*>),(*>),(<*)) | |
import Data.Char (ord) | |
import Text.Parsec (try, char, eof, oneOf, many, many1, parse, (<|>)) | |
import Text.Parsec.String (Parser) | |
{- | |
number ::= binary | octal | decimal | hexadecimal | zero | |
binary ::= '0' ('b'|'B') ('0'|'1')+ | |
octal ::= '0' ('o'|'O') ('0'..'7')+ | |
decimal ::= ('1'..'9') ('0'..'9')* |
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.Monad | |
import Data.Monoid | |
import System.IO | |
import System.Random | |
data Janken = Guu|Choki|Paa deriving (Show, Read, Eq, Enum) | |
instance Ord Janken where | |
Guu `compare` Choki = LT | |
Choki `compare` Paa = LT |
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
(function() { | |
'use strict'; | |
function toArray(n, args) { | |
return Array.prototype.slice.call(args, n); | |
} | |
function extend(obj, it) { | |
return Object.keys(obj).reduce(function(it, name) { | |
it[name] = obj[name]; |
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 GeneralizedNewtypeDeriving #-} | |
module Data.Pair (Pair, pair, (<:>)) where | |
import Data.Monoid | |
import Control.Applicative | |
newtype Pair a = Pair (a, a) deriving (Show, Eq, Monoid) | |
infixl 5 <:> | |
pair, (<:>) :: a -> a -> Pair a |
NewerOlder