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
-- stylistic | |
{-# LANGUAGE LambdaCase #-} | |
-- singletons | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE GADTs #-} | |
-- main | |
{-# LANGUAGE DataKinds #-} -- typelevel programming | |
{-# LANGUAGE TypeFamilies #-} -- typelevel programming | |
{-# LANGUAGE ScopedTypeVariables #-} -- typelevel programming |
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 ExistentialQuantification #-} | |
-- base | |
import Control.Exception | |
import Control.Concurrent.MVar | |
import Control.Monad | |
import Data.IORef | |
import System.IO.Unsafe |
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
type Sort a = SortI a '[] | |
type family SortI a b where | |
SortI '[] b = b | |
SortI (a:?n ': as) '[] = SortI as '[ a :? n] | |
SortI (a:?n ': as) bs = SortI as (Insert (a:?n) bs) | |
type family Insert a b where | |
Insert (a :? n) '[] = '[ a :? n ] | |
Insert (a :? n) ( b :? m ': bs) = UnOrdering (CmpSymbol n m) |
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, StandaloneDeriving, MultiParamTypeClasses, TypeFamilies, GeneralizedNewtypeDeriving #-} | |
import Control.Monad | |
import Control.Concurrent | |
import Control.Distributed.Process | |
import Control.Distributed.Process.Backend.SimpleLocalnet | |
import Control.Distributed.Process.Closure | |
import Control.Distributed.Process.Internal.Types (Process(..), LocalProcess) | |
import Control.Distributed.Process.Node (initRemoteTable) | |
import Control.Monad.Base (MonadBase(..)) |
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
-- | | |
-- Types and instances of anonymous records. | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} |
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 #-} | |
import Control.Applicative | |
import Data.Aeson | |
import Data.Monoid | |
import Data.Maybe | |
data Quto = Quto (Maybe Int) (Maybe String) deriving Show | |
-- Парсер поддерживающий отсуствие значений | |
instance FromJSON Quto 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
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE DefaultSignatures #-} | |
module TaggedPut where | |
import Data.Binary (Binary) | |
import qualified Data.Binary as Binary | |
import Data.ByteString.Lazy |
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 Data.List | |
import Control.Monad.ST | |
import Control.Monad | |
import Data.Array.ST | |
import Data.Array.Unboxed | |
data Exp = IfGt Int Int Block Block -- if a[i] > a[j] then blk1 else blk2 | |
| Swap Int Int -- a[i] <-> a[j] (i,j < 8) | |
| Copy Int Int -- a[i] <- a[j] (i > 7) | |
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
{-# LANGUAGE BangPatterns #-} | |
import Control.Applicative | |
import Prelude hiding (minimum, sum) | |
import Data.List (permutations) | |
import Control.Monad.ST | |
import Data.Bifunctor (second) | |
-- import Control.Monad | |
-- import Data.Array.ST | |
-- import Data.Array.Unboxed | |
import Data.Vector.Unboxed (Vector) |
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
### 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 15B0 78F1 9761 860B A04A 4263 7651 2BBA 09DD 3D53 | |
To claim this, I am signing this object: |