Skip to content

Instantly share code, notes, and snippets.

View graninas's full-sized avatar
😊
My Twitter: graninas

Alexander Granin graninas

😊
My Twitter: graninas
View GitHub Profile
@graninas
graninas / haskell_design_patterns.md
Last active May 11, 2024 12:56
Haskell Design Patterns

Design patterns in Haskell

This is a list of patterns. I'm collecting this list with an idea to write a book similar to the GoF book.

My patterns:

  • Typed / Untyped pattern
  • Typed Avatar pattern (see Hydra and Node)
    • Typed Options pattern (see EulerHS)
  • Control Structure pattern (see CLI control structure in Hydra and similar in Node)
@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active June 5, 2024 02:57
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

@graninas
graninas / On_hiring_haskellers.md
Last active March 25, 2023 16:49
On hiring Haskellers

On hiring Haskellers

Recently I noticed the number of the same two questions being asked again and again on different Haskell resources. The questions were “How to get a Haskell job” and “Why is it so hard to find Haskellers?” Although these two are coming from the opposite sides of the hiring process, the answer is really just one. There is a single reason, a single core problem that causes difficulties of hiring and being hired in the Haskell community, and we should clearly articulate this problem if we want to increase the Haskell adoption.

We all know that there are many people wishing to get a Haskell job. And a visible increase of Haskell jobs looks like there should be a high demand for Haskellers. The Haskell community has also grown like crazy past years. But still, why is it so difficult to hire and to be hired? Why can’t companies just hire any single person who demonstrates a deep knowledge of Haskell in blog posts, in chats, on forums, and in talks? And why do Haskell companies avoid hirin

@graninas
graninas / itunderhood_creations.md
Last active March 12, 2021 13:12
Творчество сообщества itunderhood
--ghc 8.0.2
type ThermometerName = String
type BarometerName = String
data Method
= ReadThermometer ThermometerName
| ReadBarometer BarometerName
| ReportTemperature
| ReportAtmospherePressure
@graninas
graninas / itbeard_poems.txt
Last active June 20, 2022 09:20
Стихи для конкурса у АйТиБороды
https://www.youtube.com/watch?v=fhMVCRWpNVc&ab_channel=%D0%90%D0%B9%D0%A2%D0%B8%D0%91%D0%BE%D1%80%D0%BE%D0%B4%D0%B0
igroykt
айтишечка и в африке айтишечка
а я питоняш, и пишу на нем код наш
иногда на пхп, выдаю я выхлоп кнеш
@graninas
graninas / holmes_code_riddle.js
Created November 26, 2022 20:27
Sherlock Holmes and a Code Riddle
// https://www.tutorialspoint.com/online_processingjs_editor.php
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.6.6/processing.min.js"></script>
<script type="application/processing" data-processing-target="pjs">
dW = 4; dH = 20; dWH = dW/2; dHH = dH/2;
gSh = dWH/2; r = dW/sqrt(2); fs = 2 * (dH);
{-# LANGUAGE AllowAmbiguousTypes #-}
module Test2 where
import Control.Monad.Free
import Control.Monad
data BreadType = Baguette | Toast
deriving (Show, Eq, Ord)
@graninas
graninas / state_church_free.h
Last active September 12, 2023 17:18
Path 1 to implement the State monad in C++ using Church Free
# This is a sample of how to implement the State monad with Church Free monad.
# This sample is incomplete, but its concept is taken from my Free-monad based STM library.
# Consider the library to implement the rest of the code. The idea is the same.
# https://github.com/graninas/cpp_stm_free
#include <functional>
#include <variant>
#include <any>
@graninas
graninas / gist:32a2cd52c062c42bccbad9e8b69b6360
Last active September 13, 2023 18:51
Path 2 to implement the State monad in C++ using Church Free
# This is an idea of how to merge the State monad and the Church Free monad
# without interferring with the inner eDSL.
# This code is incomplete and requires a further development.
# The idea is that we pass the state around with the Church Free functions
# as we would do it with a regular State monad.
# The overal concept is based on my Free monadic STM implementation:
# https://github.com/graninas/cpp_stm_free