Skip to content

Instantly share code, notes, and snippets.

View mrsekut's full-sized avatar
🥺
カタカタな世界に生きたい

kota marusue mrsekut

🥺
カタカタな世界に生きたい
View GitHub Profile
@ttesmer
ttesmer / AD.hs
Last active July 22, 2024 05:21
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v

放送で紹介する用。書きかけです。

ちょっと伸びたのでさらに追記。これは元々自分の勉強がてら書いていたもので、これを書く過程でどうしても自分の理解では説明できないところがあり koba789 に依頼してペアプロをしてもらった、という流れがあります。その結果が次の動画です。

https://t.co/FIBmVrR83U

生放送の流れを円滑にするために資料を公開しましたが、この記事は未完成で、あとでさらに整理して別途記事にまとめるつもりです


@sindresorhus
sindresorhus / esm-package.md
Last active July 24, 2024 08:34
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@Lipranu
Lipranu / shell.nix
Created January 19, 2021 17:58
nix shell with ghc 9.0.1
let pkgs = import (fetchTarball path) {};
path = https://github.com/NixOS/nixpkgs/archive/master.tar.gz;
in with pkgs;
mkShell {
buildInputs = [
haskell.compiler.ghc901
];
}
@sketchbuch
sketchbuch / typescript-http-status-codes.ts
Last active April 27, 2021 08:32
TS - Typescript HTTP Status Code Enums and Types
export enum HttpStatusCodes100 {
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
PROCESSING = 102,
EARLY_HINTS = 103,
}
export enum HttpStatusCodes200 {
OK = 200,
CREATED = 201,
module Main where
import Prelude
import Control.Monad.Reader (Reader, runReader, ReaderT(..), runReaderT, ask, class MonadAsk)
import Effect (Effect)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Console (log)
---------------------------------------------------------
@vijayanant
vijayanant / HigherRankedTypes.hs
Last active July 4, 2024 08:03
Rank N Types in Haskell
{-# LANGUAGE RankNTypes #-}
module RankN where
-- Rank 0:
-- add1 is momomorphic
add1 :: Int -> Int
add1 x = x + 1
-- Rank 1

Nix Flake MVP

Goals

  • To provide Nix repositories with an easy and standard way to reference other Nix repositories.

  • To allow such references to be queried and updated automatically.

  • To provide a replacement for nix-channel, NIX_PATH and Hydra

@sile
sile / rfc.md
Last active June 2, 2022 15:19
Rustの『RFC 2033: 実験的なコルーチン』の要約メモ

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.