Skip to content

Instantly share code, notes, and snippets.

Avatar
🔨
Right tool for the right job

Андреев Кирилл Heimdell

🔨
Right tool for the right job
  • Ульяновск
View GitHub Profile
View Color.hs
module Color where
type Color = (Int, Int)
toCode :: Color -> String
toCode (hue, -1) = show (30 + hue) ++ ";2"
toCode (hue, 0) = show (90 + hue)
toCode (hue, 1) = show (30 + hue) ++ ";1"
toCode c = error $ "toCode: should be (0..16 (15?), -1.. 1), but it is " ++ show c
@Heimdell
Heimdell / roll.hs
Last active Jul 30, 2021
Create new haskell package _fast_
View roll.hs
#!/usr/bin/env stack
-- stack --resolver lts-17.14 script
{-# language LambdaCase #-}
import System.Environment
import System.Directory
import System.FilePath
main = do
View Closure.cs
using System;
using System.Collections.Generic;
// For clarity. In haskell, standard Dictionary is called "Map".
//
using Set1 = System.Collections.Generic.HashSet<int>;
using Map1 = System.Collections.Generic.Dictionary<int, System.Collections.Generic.HashSet<int>>;
class Closure {
View octree.rs
use std::sync::Arc;
enum Octree<B, A>
{ Branch
{ preview : B
, subtrees : [Arc<Octree<B, A>>; 8]
}
, Atom
{ leaf : A
View Chunk.hs
{- | A chunk of 16x16x16 atoms.
-}
module Chunk where
import Prelude hiding (read)
import Control.Monad
import Control.Monad.Primitive
View Effects.hs
module Union where
import Control.Monad
import qualified Control.Monad.Reader as MTL
data Union fs (m :: * -> *) x where
Here :: f m x -> Union (f : fs) m x
There :: Union fs m x -> Union (f : fs) m x
View AST.hs
module AST where
import Data.Constraint
import Data.Functor.Compose
import Data.Fix
import Data.Text (Text)
import qualified Data.Text as Text
import GHC.TypeLits
View Product.hs
{-# language DataKinds #-}
{-# language DerivingStrategies #-}
{-# language DeriveFunctor #-}
{-# language FlexibleContexts #-}
{-# language FlexibleInstances #-}
{-# language FunctionalDependencies #-}
{-# language GADTs #-}
{-# language KindSignatures #-}
{-# language MultiParamTypeClasses #-}
{-# language ScopedTypeVariables #-}
View Weld.hs
module Weld where
import Control.Arrow
import Data.Bifunctor as B
import Text.PrettyPrint as PP hiding ((<>))
infix 1 \/
View Optics.Core.elm
module Optics.Core exposing
( Optic
, id
, o
, lens
, prism
, traversal
, view