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
{-# OPTIONS_GHC -XForeignFunctionInterface #-} | |
{-# OPTIONS_GHC -O2 -optc-O2 #-} | |
module Main where | |
import Foreign | |
import Foreign.C | |
import System.IO | |
foreign import ccall unsafe "stdio.h &fdopen" |
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
{-# LANGUAGE ForeignFunctionInterface #-} | |
module Main where | |
import Foreign | |
import Control.Exception (bracket) | |
import Control.Monad | |
import Control.Monad.Cont () | |
import Data.Maybe | |
import Graphics.Win32 hiding (moveWindow, c_MoveWindow) -- param type should be INT, not Int |
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
Arrow を見ていると多幸感がございますな。。。 | |
とりあえず Haskell & Arrow の勉強のため、恒等変換探索機を作ってみたが、 | |
まだまだルールベースが全然足りていない。。。 | |
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 com.github.okomok.ken | |
object ArrowLoopFib extends ken.Main { | |
import ken._ | |
import List.{tail, zipWith} | |
import Tuple2.snd | |
val fibSeqFrom = locally { | |
// use Function Arrow in this environment | |
import Function.{app, loop, &&&:, ***:, <<<:, >>>:} |
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 com.github.akihiro4chawon.arm.arrow._ | |
import scalaz._ | |
import Scalaz._ | |
object Main extends App { | |
import java.io._ | |
// なんの変哲もない部分 | |
def copyStream(is: InputStream, os: OutputStream, buffSize: Int) { | |
val buff = new Array[Byte](buffSize) |
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 com.github.akihiro4chawon.arm._ | |
import scalaz._ | |
import Scalaz._ | |
object Main extends App { | |
import java.io._ | |
// なんの変哲もない部分 | |
def copyStream(is: InputStream, os: OutputStream, buffSize: Int) { | |
val buff = new Array[Byte](buffSize) |
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.Applicative | |
import Control.Arrow(first) | |
import Control.Monad | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Data.Maybe | |
import Data.Monoid | |
import Data.Function | |
import MyHeap |
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
{-# LANGUAGE BangPatterns #-} | |
{-# OPTIONS_GHC -Wall -O2 #-} | |
import Control.Arrow((***)) | |
import Control.Monad(ap, join) | |
import Control.Monad.Instances() | |
import Data.List(foldl', genericLength, genericReplicate, genericSplitAt) | |
import Data.Function(on) | |
-- |
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
{-# LANGUAGE BangPatterns #-} | |
{-# OPTIONS_GHC -Wall -O2 #-} | |
import Control.Arrow((***)) | |
import Control.Monad(ap, join) | |
import Control.Monad.Instances() | |
import Data.List(foldl', genericLength, genericReplicate, genericSplitAt) | |
import Data.Function(on) | |
newtype Modulo = Modulo { getInteger :: Integer} |
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
{-# LANGUAGE BangPatterns #-} | |
{-# OPTIONS_GHC -Wall -O2 #-} | |
-- 使用例 | |
import Control.Monad(ap, join) | |
import Control.Monad.Instances() | |
import Data.List(foldl', genericLength, genericReplicate, genericSplitAt) | |
-- 結局 bang pattern を使うように書き直しているっていう。。。 |