Effect handlersについて調べた時のメモ書きです。 OCamlについては初心者です。
参考文献
Effect handlersについて調べた時のメモ書きです。 OCamlについては初心者です。
参考文献
open Effect | |
open Effect.Deep | |
open Effect.Shallow | |
type _ Effect.t += Get: int t | |
| Put: int -> unit t | |
| Exc: string -> unit t | |
let run_reader (i : int) e = | |
try_with e () |
package monadicDC | |
import scala.annotation.tailrec | |
enum Equal[A, B] { | |
case EQ[A]() extends Equal[A, A] | |
case NE() | |
} | |
opaque type Prompt[A] = Int |
:- use_module(library(clpfd)). | |
piece(_, []). | |
piece([_ | Frame], [[] | Piece]) :- | |
piece(Frame, Piece). | |
piece([[X | FrameLine] | Frame], [[X | PieceLine] | Piece]) :- | |
piece([FrameLine | Frame], [PieceLine | Piece]). | |
tail([], []). | |
tail([_ | T], T). |
scala> trait Eff[+R[_], A] | |
// defined trait Eff | |
scala> enum Reader[I, A] { case Ask[I]() extends Reader[I, I] } | |
// defined class Reader | |
scala> enum Writer[W, A] { case Tell[W](value: W) extends Writer[W, Unit] } | |
// defined class Writer | |
scala> def run[A](eff: Eff[Nothing, A]): A = ??? |
# 値によって変わる型 | |
[@halcat0x15a](https://twitter.com/halcat0x15a) | |
--- | |
## 今日はなすネタ | |
面白そうなツイートを見つけた |
import os | |
import re | |
import time | |
import picamera | |
import slack | |
import RPi.GPIO as GPIO | |
SERVO_OUT = 2 | |
IMAGE_FILENAME = 'test.jpg' | |
RECORDING_FILENAME = 'test.h264' |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds, PolyKinds #-} | |
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts #-} | |
module EffAp where | |
import Control.Concurrent | |
import Control.Concurrent.Async | |
import OpenUnion |
八十吉 https://goo.gl/maps/xcB9bywSuVH2 | |
パリのワイン食堂 https://goo.gl/maps/xyGtCvkXEkC2 | |
Yellow Spice https://goo.gl/maps/EgZtWRshyNz | |
牛庵 https://goo.gl/maps/9SupA9A3a4m | |
にし邑 https://goo.gl/maps/crmh17r1kSo | |
築地きたろう https://goo.gl/maps/8mcNNPy37tS2 | |
ピラミッド https://goo.gl/maps/epHvBkLVcg52 | |
むぎとオリーブ https://goo.gl/maps/k1PjHkyrCPm | |
だいつねうどん https://goo.gl/maps/wi8ZrD1PM3J2 | |
東京油組総本店 https://goo.gl/maps/UC7q3M9bnCv |
package starlight | |
import akka.actor.Actor | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.FileIO | |
import akka.stream.scaladsl.Source | |
import java.awt.RenderingHints | |
import java.awt.image.BufferedImage |