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
/* | |
* Mathlib : A C Library of Special Functions | |
* Copyright (C) 1998 Ross Ihaka | |
* Copyright (C) 2000-2014 The R Core Team | |
* Copyright (C) 2007 The R Foundation | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. |
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
#!/usr/bin/env cabal | |
{- cabal: | |
build-depends: base, mwc-random | |
ghc-options: -with-rtsopts=-s -Wall | |
-} | |
{- | |
Copyright (C) 1998 Ross Ihaka | |
Copyright (C) 2000-2014 The R Core Team | |
Copyright (C) 2007 The R Foundation |
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 qualified Data.Vector.Unboxed.Mutable as VM | |
import qualified Data.Vector.Unboxed as V | |
import Control.Monad.ST (runST) | |
import Control.Monad (when) | |
sieve :: Int -> V.Vector Bool | |
sieve n = runST $ do | |
vm <- VM.new n |
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
-- Run this example with runhaskell: | |
-- | |
-- $ runhaskell infinite-string-stream.hs | |
-- | |
-- Type in some text and press enter. | |
-- Repeat as long as you like. | |
-- At the end press CTRL-d to quit. | |
-- | |
-- Using unsafeInterleaveIO the text you put in will appear immediately after | |
-- each new line. Without it, the output will only be printed after you quit |
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 OverloadedStrings #-} | |
module Main (main) where | |
import qualified Data.ByteString.Char8 as B | |
import System.IO | |
import Data.List | |
import qualified Data.Vector as V | |
import Data.Foldable | |
generateWords :: [B.ByteString] -> B.ByteString -> [B.ByteString] |
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 #-} | |
module Main where | |
import qualified Data.ByteString as S -- S for strict (hmm...) | |
import qualified Data.ByteString.Internal as S | |
import qualified Data.ByteString.Unsafe as S | |
import qualified Data.ByteString.Lazy.Internal as L | |
import Foreign | |
import Gauge.Main |
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 RankNTypes, TypeOperators, FlexibleContexts, UndecidableInstances, TypeApplications, LambdaCase, ScopedTypeVariables, BlockArguments, DeriveFunctor, KindSignatures, ExistentialQuantification, FlexibleContexts #-} | |
{-# OPTIONS_GHC -Wall -Wno-orphans #-} | |
module Control.Ev.Scope where | |
import Control.Applicative | |
import Control.Ev.Eff | |
import Control.Monad | |
import Data.Foldable | |
import Data.Functor ( (<&>) ) | |
import Debug.Trace |
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 NamedFieldPuns #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Weave | |
( Weaver | |
, cons |
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 Foreign.C | |
import Control.Concurrent | |
import System.IO.Unsafe | |
import Data.Foldable | |
foreign import ccall unsafe "keep_sleeping" c_keep_sleeping :: CInt -> IO CInt | |
{-# NOINLINE children #-} | |
children :: MVar [MVar ()] | |
children = unsafePerformIO (newMVar []) |
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 Prelude hiding (id, (.)) | |
import Control.Arrow | |
import Control.Category | |
import qualified Data.List as List | |
data StaticParser s = SP Bool [s] | |
newtype DynamicParser s a b = DP ((a, [s]) -> (b, [s])) | |
data Parser s a b = P (StaticParser s) (DynamicParser s a b) | |
instance Eq s => Category (Parser s) where |
OlderNewer