This file contains hidden or 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
export default class Fold<A, B> { | |
private constructor( | |
private readonly state: any, | |
private readonly step: (x: A, st: any) => any, | |
private readonly done: (st: any) => B | |
) {} | |
public static of<A, B, S>( | |
state: S, | |
step: (x: A, st: S) => S, |
This file contains hidden or 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
const std = @import("std"); | |
const Allocator = std.mem.Allocator; | |
const c = @cImport({ | |
@cInclude("./gl_core_3_3.h"); | |
@cInclude("SDL2/SDL.h"); | |
@cInclude("SDL2/SDL_opengl.h"); | |
}); | |
const SDLError = error{ | |
FailedInit, |
This file contains hidden or 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
const std = @import("std"); | |
const c = @cImport(@cInclude("SDL2/SDL.h")); | |
const SDLError = error{ | |
FailedInit, | |
FailedCreatingWindow, | |
FailedGettingEvent, | |
FailedDraw, | |
FailedScreenUpdate, | |
}; |
This file contains hidden or 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
fmod LAMBDA is pr NAT . pr QID . | |
*** User-level lambda expressions, using named binders. | |
sorts Expr EName . | |
subsort Nat EName < Expr . | |
subsort Qid < EName . | |
op __ : Expr Expr -> Expr [ctor] . | |
op [\_._] : EName Expr -> Expr [ctor] . | |
op let_:=_in_ : EName Expr Expr -> Expr . | |
eq let X := A in B = [\ X . B ] A . |
This file contains hidden or 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
module filter where | |
open import Data.Bool using (Bool; true; false) | |
open import Data.List using (List; []; _∷_) | |
open import Data.Nat using (ℕ; suc; _≤_; z≤n; s≤s; _≟_) | |
open import Data.Nat.Properties using (≤-trans) | |
open import Data.Nat.Show using (show) | |
open import Data.Product using (Σ-syntax; _×_; _,_) | |
open import Data.String using (String) | |
open import Data.Vec using (Vec; []; _∷_) |
This file contains hidden or 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
make/config.mk: | |
--- | |
DDC_FLOW_USE_LINEAR_SOLVER = 1 | |
================================================================================================================= | |
$ make war | |
... | |
(181.0/380) test/ddc-regress/core/04-Flow/80-Rate/30-Map2/Test.dcx std run success (138.3ms) | |
-- Output Differs ------------------------------------------------------------- | |
expected file: test/ddc-regress/core/04-Flow/80-Rate/30-Map2/Test.stdout.check |
This file contains hidden or 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
module typecheck where | |
data Type = Int | Type ==> Type | |
data AST | |
= Lit Int | |
| Var Type String | |
| App Type AST AST | |
| Lam Type String AST |
This file contains hidden or 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
module Main (main) where | |
import Control.Concurrent (threadDelay) | |
import Control.Exception (catch, throwIO) | |
import Control.Monad (when, forM_) | |
import Control.Monad.IO.Class (MonadIO, liftIO) | |
import Control.Monad.Trans.Writer | |
import Control.Monad.Trans.Class (lift) | |
import Data.Machine.Concurrent | |
import Data.Time.Clock (UTCTime, addUTCTime, diffUTCTime, getCurrentTime) |
This file contains hidden or 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
module Main (main) where | |
import Control.Applicative (optional) | |
import Control.Monad (replicateM) | |
import Control.Monad.Trans.State (State, runState, state) | |
import Data.List (sortOn) | |
import Data.Maybe (isJust) | |
import Data.Ord (Down(Down)) | |
import System.Environment (getArgs) | |
import System.Random (RandomGen, getStdGen, randomR, setStdGen) |
This file contains hidden or 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 DeriveFunctor #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
import Data.Semigroup | |
example :: Validation [String] Int Int | |
example = do | |
x <- (+) <$> validation ["not even"] even | |
<*> validation ["not positive"] (0 <) | |
y <- validation ["not divisible by four"] (\a -> a `mod` 4 == 0) |
NewerOlder