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
module Parser1 where | |
-- | On importe uniquement quelques types de base, quelques fonctions | |
-- et quelques opérateurs habituels | |
import Prelude ( String, Maybe(..), Char, Int, Show(..), | |
fmap, fst, read, | |
splitAt, length, span, elem, | |
($), (.), (==), (+), (*) ) |
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 GADTs , KindSignatures #-} | |
data Zero | |
data Succ a | |
data List :: * -> * -> * where | |
Nil :: List Zero a | |
Cons :: a -> List t a -> List (Succ t) a | |
data AnyList :: * -> * 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
require 'funkr/types' | |
class Reader | |
def initialize(func); @func = func; end | |
def run(env); @func.call(env); end | |
# Pour l'usage du foncteur applicatif | |
def map(&block); reader{|env| block.call(run(env))}; end | |
def self.pure(v); reader{|_env| v}; end | |
def apply(to); reader{|env| run(env).call(to.run(env))}; 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
module Main where | |
import Control.Monad (forever) | |
import Control.Concurrent (forkIO) | |
import Control.Concurrent.Chan | |
import Data.Pool | |
import Database.HDBC | |
import Database.HDBC.PostgreSQL |
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 TemplateHaskell, TypeSynonymInstances, FlexibleInstances #-} | |
module Text.InterpolatedString.Interp (qc, q) where | |
import qualified Language.Haskell.TH as TH | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Char8 as C8 | |
import Language.Haskell.TH.Quote | |
data StringPart = Literal String | Binding String deriving Show |
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
module Main where | |
import Data.Char (ord) | |
import Network.Socket hiding (recv) | |
import qualified Data.ByteString as S | |
import qualified Data.ByteString.Char8 as C8 | |
import qualified Data.ByteString.UTF8 as U8 | |
import Network.Socket.ByteString (recv, sendAll) |
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
---- group posts by years | |
groupByYear :: [Page a] -> [(String, [Page a])] | |
groupByYear = map (\pg -> ( year (head pg), pg) ) . | |
groupBy (\ a b -> year a == year b) | |
where year :: Page a -> String | |
year = take 4 . takeBaseName . getField "path" | |
addYearList :: String |
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
group "processTags" $ match "published/*" $ compile $ readPageCompiler | |
create "tags" $ | |
( requireAll | |
( (inGroup $ Just "processTags") `mappend` "published/*" ) | |
(\_ ps -> readTags ps :: Tags String) ) | |
-- Add a tag list compiler for every tag | |
match "tags/*" $ route $ setExtension ".html" | |
metaCompile $ require_ "tags" |
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
### usage : ruby(version) mem.rb STRING_SIZE [cow] | |
### 1 < string_size < 9 | |
### cow to activate copy on write (ree only) | |
def ram_usage | |
`pmap #{Process.pid} | tail -1`.split[1][0..-2].to_i | |
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
module Main where | |
import Control.Concurrent (forkIO) | |
import Control.Monad (forever, unless) | |
import Network (PortID(PortNumber),listenOn) | |
import Network.Socket hiding (listen,recv,send) | |
import Network.Socket.ByteString (recv,sendAll) | |
import qualified Data.ByteString as S | |
import System.Posix (Handler(Ignore),installHandler,sigPIPE) |
NewerOlder