Skip to content

Instantly share code, notes, and snippets.

View qnikst's full-sized avatar
🐧
penguin?

Alexander Vershilov qnikst

🐧
penguin?
View GitHub Profile
@qnikst
qnikst / A.hs
Created November 21, 2020 03:29
module A (A(..)) where
newtype A = A Int
deriving (Show, Eq)
-- | Create new cache service.
--
new
:: (Show a, Hashable a, Ord a)
=> LoggerEnv
-> Config
-> IO (Handle a b)
new ctx' cfg@Config {..} = do
ref <- newIORef PSQ.empty
pure $ Handle
@qnikst
qnikst / events.markdown
Last active September 15, 2023 17:13
Предстоящие Haskell события

Предстоящие события

  • 2023-09-26 Казань. Митап по функциональному программированию в Казани Регистрация

    Темы:

    — про software transactional memory (STM) и том, какие проблемы она решает;

— как работать с иммутабельными данными удобно и без боли.

@qnikst
qnikst / Foo.hs
Last active August 27, 2019 21:05
import Data.Binary
import Data.Binary.Get
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
stream :: Binary a => BL.ByteString -> [a]
stream = go (runGetIncremental get) . BL.toChunks where
go (Done rest _ a) []
| B.null rest = [a]
import Data.Traversable
import Data.Foldable
import Data.List
import System.IO.Unsafe
import System.Directory
main = do
xs <- foo ["/Users/qnikst/"]
for_ xs $ putStrLn
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
type family Head x where
Head (x ': xs) = x
@qnikst
qnikst / keybase.md
Created April 28, 2018 20:29
keybase.md

Keybase proof

I hereby claim:

  • I am qnikst on github.
  • I am qnikst (https://keybase.io/qnikst) on keybase.
  • I have a public key whose fingerprint is EFAF B695 F51C 6586 9337 44E1 5F9D 9342 5E05 C6C2

To claim this, I am signing this object:

{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
-- Linear IO, in `IO a` - `a` have to have 1 weight.
import SIO
@qnikst
qnikst / test
Created November 8, 2017 19:15
play with parse
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
@qnikst
qnikst / idris.hs
Created November 7, 2017 21:51
Play idris on haskell
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ExistentialQuantification #-}
module Main where