Skip to content

Instantly share code, notes, and snippets.

View cblp's full-sized avatar

Yuriy Syrovetskiy cblp

  • Montenegro
View GitHub Profile
#!/usr/bin/env stack
-- stack runhaskell
{-# OPTIONS_GHC -Wall -Wno-orphans #-}
import Data.Bifunctor
import Data.Foldable
import Data.List.NonEmpty (NonEmpty ((:|)))
import Data.Tree
import Test.QuickCheck
#include <algorithm>
using std::transform;
#include <iostream>
using std::cerr;
using std::cout;
using std::endl;
#include <string>
using std::string;
#include <vector>
using std::vector;
module CountLines where
import Prelude hiding (length, lines,
readFile)
import Control.Monad.Trans.Resource (runResourceT)
import Data.ByteString.Streaming.Char8 (lines, readFile, toLazy)
import Streaming (mapped)
import Streaming.Prelude (fst', length)
@cblp
cblp / req.hs
Last active March 23, 2019 12:08
#!/usr/bin/env stack
-- stack --resolver=lts-13.10 script
{-# LANGUAGE OverloadedStrings #-}
import Data.Default
import Network.HTTP.Req
main :: IO ()
main = do
#!/usr/bin/env stack
-- stack --resolver=lts-13.10 script
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text.Lazy as TextL
import Math.NumberTheory.Recurrencies
import Web.Scotty
main = scotty 8080 $
@cblp
cblp / Interpolate.hs
Last active February 27, 2019 12:35
Run as `./Interpolate.hs`
#!/usr/bin/env stack
-- stack --resolver=lts-13.0 script
{-# LANGUAGE TemplateHaskell #-}
import Data.String.Interpolate (i)
import Language.Haskell.TH.Quote (quoteExp, quoteFile)
main = putStr $(quoteExp (quoteFile i) "hello.txt") where
world = "мир"
-- stack --resolver=lts-13.8 script
{-# OPTIONS -Wall -Wno-orphans #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
import Data.EDN (Tagged (..), TaggedValue, Value (..), renderText)
{-# LANGUAGE OverloadedStrings #-}
import Control.Concurrent (forkIO)
import Control.Monad (void)
import Data.IORef (IORef, atomicModifyIORef, newIORef,
readIORef)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Text (Text)
@cblp
cblp / fun.cpp
Created December 13, 2018 12:04
#include <functional>
#include <iostream>
using namespace std;
function<int(int)> add(int x) {return [=](int y){return x + y;};}
int main() {
cout << add(1)(2) << endl;
return 0;
}
@cblp
cblp / input.hs
Last active October 17, 2018 16:32
Haskell RON RGA example
:{
Right note4 = runNetworkSim $ do
Right note1 <-
runReplicaSim (applicationSpecific 1) $
runExceptT $
newObject Note
{ note_end = Nothing
, note_start = fromGregorian 2018 10 17
, note_status = TaskStatus Active
, note_text = "пример"