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 OverloadedStrings #-} | |
| import Data.Conduit | |
| import Data.Conduit.Network | |
| import Data.Conduit.Text (encode, decode, utf8) | |
| import qualified Data.Conduit.List as CL | |
| import qualified Data.Conduit.Binary as CB | |
| import Data.Text (toUpper) | |
| import qualified Data.ByteString.Char8 as S8 |
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
| class RpcMethodType f where | |
| type BaseM f :: * -> * | |
| toRpcMethod :: f -> RpcMethod (BaseM f) | |
| instance (Functor m, MonadIO m, OBJECT o) => RpcMethodType (m o) where | |
| type BaseM (m o) = m | |
| toRpcMethod m = \[] -> toObject <$> m | |
| instance (OBJECT o, RpcMethodType r) => RpcMethodType (o -> r) where | |
| type BaseM (o -> r) = BaseM r |
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 BangPatterns #-} | |
| module Main where | |
| import Control.Applicative | |
| import Control.Monad | |
| import Control.Monad.ST | |
| import Data.Array.ST | |
| import Data.List (sort) |
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 qualified Data.ByteString.Lazy.Char8 as L | |
| import System.Environment | |
| main :: IO () | |
| main = go False =<< getArgs where | |
| go _ ("-f": rest) = go True rest | |
| go _ [] = print . gyo =<< L.getContents | |
| go _ ["-"] = print . gyo =<< L.getContents | |
| go f files = forM_ files $ \file -> 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
| {-# LANGUAGE OverloadedStrings #-} | |
| import Control.Applicative | |
| import Control.Concurrent (threadDelay) | |
| import Control.Concurrent.Async (async, race_, wait) | |
| import Control.Monad | |
| import qualified Data.ByteString as S | |
| import Data.ByteString.Char8 () | |
| import Data.Conduit | |
| import Data.Conduit.Network |
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 DeriveDataTypeable #-} | |
| import Data.Binary as B | |
| import Data.Binary.Shared as S | |
| import qualified Data.ByteString.Lazy as L | |
| import Data.Typeable | |
| import Data.List | |
| import System.Random | |
| import Control.Monad |
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.Lens | |
| import Control.Monad | |
| import Control.Monad.State | |
| import Data.List | |
| import qualified Data.Map as M | |
| paint :: M.Map (Int, Int) Char -> (Int, Int) -> Int | |
| paint mm pos = evalState (go pos) mm where | |
| go (i, j) = do | |
| b <- use $ at (i, j) |
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.Category | |
| import Prelude hiding (id, (.)) | |
| data Lens a b | |
| = Lens | |
| { get :: a -> b | |
| , set :: b -> a -> 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
| -- Initial iconv-conduit.cabal generated by cabal init. For further | |
| -- documentation, see http://haskell.org/cabal/users-guide/ | |
| name: iconv-conduit | |
| version: 0.1.0.0 | |
| -- synopsis: | |
| -- description: | |
| license: BSD3 | |
| license-file: LICENSE | |
| author: Hideyuki Tanaka |
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
| mylist :: Int -> [[Int]] | |
| mylist n = take n $ iterate (map (+n)) [1..n] | |
| main :: IO () | |
| main = print.last.last $ map reverse $ mylist 4000 |