This file contains 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 KindSignatures, DataKinds, RankNTypes, | |
TypeOperators, TypeFamilies, ScopedTypeVariables, GADTs, | |
StandaloneDeriving #-} | |
module Fin where | |
import Data.Proxy | |
import Data.Singletons.Prelude | |
import Data.Singletons.TypeLits | |
newtype Fin (n :: Nat) = Fin Int |
This file contains 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
open Lwt | |
let go handle = | |
let rec loop () = | |
Lwt.catch | |
loop | |
handle | |
in | |
loop () |
This file contains 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
{-# OPTIONS_GHC -fno-warn-orphans #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} |
This file contains 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 LambdaCase #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
module Main where | |
import Prelude hiding (repeat) |
This file contains 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
[user] | |
name = $FULL_NAME | |
email = $EMAIL_ADDRESS | |
[color] | |
ui = auto | |
diff = auto | |
status = auto | |
branch = auto |
This file contains 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
let struct_to_string m = | |
let parts = List.map (fun (k, v) -> Printf.sprintf "%s = %s" k v) m in | |
let combined = String.concat "; " parts in | |
Printf.sprintf "{ %s }" combined | |
let string_of_string s = Printf.sprintf "%S" s | |
let string_of_option f = function | |
| None -> "None" | |
| Some v -> "Some " ^ f v |
This file contains 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 overview: | |
* | |
* Transition : contains a witness of valid transitions | |
* State : wrapper for states, and handler for events given some state | |
* Event : incoming events | |
* Effect : resulting effects | |
* Follower / Candidate / Leader : states | |
* | |
* Every module of Follower, Candidate and Leader have a state type, t, and an | |
* 'event_witness' type which defines the events their respective handler |
This file contains 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
(* This works *) | |
module W = struct | |
type a | |
type b | |
type (_, _) t = | |
| AA : (a, a) t | |
| AB : (a, b) t | |
| BB : (b, b) t |
This file contains 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 FlexibleContexts #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Main (insert, delete, lookup, runTrackedMap, main) where | |
import Prelude hiding (lookup) | |
import Control.Applicative (Applicative) | |
import Data.Set (Set) |
This file contains 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 type Monad = sig | |
type 'a t | |
val return : 'a -> 'a t | |
val bind : 'a t -> ('a -> 'b t) -> 'b t | |
end | |
module Client : sig | |
type key = string | |
type value = string |
OlderNewer