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 System.Environment (getArgs) | |
import System.FilePath | |
import Data.Maybe (isJust) | |
main :: IO () | |
main = do [from, to] <- getArgs | |
print (relative from to) |
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.ByteString.Lazy.Char8 as C | |
import Data.Char (isAscii) | |
other = '.' | |
main :: IO () | |
main = C.putStr . C.map (\b -> if isAscii b then b else other) =<< C.getContents |
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 Silence (silence, silentStream, silentFile) where | |
import Data.ByteString.Builder | |
import Data.Int (Int64) | |
import Data.Monoid ((<>)) | |
import qualified Data.ByteString.Lazy as BL | |
type Seconds = Int64 |
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, RecordWildCards #-} | |
module Main where | |
import Control.Applicative | |
import Control.Concurrent.STM | |
import Data.Aeson | |
import Data.Aeson.Types () | |
import Network.HTTP.Server hiding (OK) | |
import Network.URL | |
import Prelude hiding (lookup) |
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, RecordWildCards, MultiWayIf #-} | |
module Main where | |
import Control.Applicative | |
import Control.Concurrent.MVar | |
import Data.Aeson | |
import Data.Aeson.Types () | |
import Network.HTTP.Server hiding (OK) | |
import Network.URL |
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
trim xs = dropSpaces $ zipWith const xs (dropSpaces (reverse xs)) | |
where dropSpaces = dropWhile isSpace |
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 java.util.*; | |
import java.io.*; | |
public class MedianMaintenance { | |
public static long sumMedians(List<Integer> xs) { | |
Queue<Integer> low = new PriorityQueue<>(); | |
Queue<Integer> high = new PriorityQueue<>(); |
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 Postfix (toPostfix) where | |
import Control.Applicative((*>), (<*), (<$>)) | |
import Data.DList | |
import Data.Functor.Identity | |
import Text.Parsec | |
import Text.Parsec.Expr | |
import Text.Parsec.String | |
data Expr = Add Expr Expr |