You are the "Momentum Engine," managing the state of the session in-context, presenting a template for the user to fill out, and then analyzing the user's response to generate a suggestion.
# Get current date and time
module Fold = struct | |
module T = struct | |
type ('a, 'e) t = Fold : ('x -> 'e -> 'x) * 'x * ('x -> 'a) -> ('a, 'e) t | |
let make ~step ~init ~finish = Fold (step, init, finish) | |
let map = | |
`Custom | |
(fun (Fold (step, init, finish)) ~f -> | |
Fold (step, init, fun x -> finish x |> f)) |
Before there is an official tool to directly generate an offline transaction with the standard mina-generate-keypair
generated private key, we can instead convert the key to the client-sdk compatible format and then use the client-sdk to generate the transaction.
A while ago I shared this idea with @nholland94, who in turn made a script that I then tweaked to use Docker and created this one. Thanks @nholland94 !
@nholland94's script minimizes the time that the private key is unencrypted by immediately creating the transaction as soon as the key is dumped.
Version 2 of this script replaces the key loading functionality from relying on the mina daemon via docker to doing everything through NodeJS -- thanks to Auro wallet ( https://github.com/bitcat365/auro-wallet-browser-extension/blob/0888a71dc6abde41ad72889c1826a722c3954553/src/background/accountService.js#L58 ) for the routine of loading the libsodium-encrypted wallet files.
Before there is an official tool to directly generate an offline transaction with the standard mina-generate-keypair
generated private key, we can instead convert the key to the client-sdk compatible format and then use the client-sdk to generate the transaction.
A while ago I shared this idea with @nholland94, who in turn made a script that I then tweaked to use Docker and created this one. Thanks @nholland94 !
@nholland94's script minimizes the time that the private key is unencrypted by immediately creating the transaction as soon as the key is dumped.
One of the greatest tools to tame complexity in a growing codebase, growing either via lines of code or via people, is through strategic information hiding — you may know this as encapsulation, modularization, or data abstraction. In this post, we'll explore data abstraction's definition and capabilities from a formal perspective and show to what extent we can achieve the ideal through Swift, TypeScript, OCaml, ReasonML, Rust, and Haskell. Knowing how to use data abstraction in your language of choice is important in the short term, but understanding and naming the general concepts equips you to understand these tools as our languages evolve and change.
Data abstraction is about abstracting away the details of data structures and manipulating them at will, so that you don't have to worry about their internals anymore. It's not just about avoiding memory leaks, it's also about avoiding having to think about the underlying representation of those values in the first place. This allows for more flexibility when
module WordGuess; | |
// This is an attempt to model a game of "word guess" | |
// All communication flows through board (maybe that makes this whole thing | |
// trivial) | |
// There are 4 players, 2 on red team and 2 on blue team | |
// | |
// Roughly, there is a leader selected in a round-robin fashion, the leader sees | |
// a full board of words and shouts a word+#. The player on that team uses the | |
// word as a hint and can make up to # of guesses unless they get one wrong. |
import Bow | |
import SwiftUI | |
public typealias Component<W: Comonad, V: View> = | |
Kind<W, SwiftUIBackendOf<CoOf<W, ()>, V>> | |
func const<A,B>(_ x: A) -> (B) -> A { return { _ in x } } | |
public final class ComponentView<W: Comonad, V: View>: View { | |
private var component: Component<W, V> |
import Bow | |
// This version of Co seems to work even thoug it's a bit gross to deal with Any | |
// Think of this as an example of how to deal with rank2 type polymorphism -- you only | |
// deal with Any in the constructor, even `runCo` has a generic interface. | |
// newtype Co w a = Co (forall r. w (a -> r) -> r) | |
public final class ForCo {} | |
public final class CoPartial<W: Comonad>: Kind<ForCo, W> {} | |
public typealias CoOf<W: Comonad, A> = Kind<CoPartial<W>, A> |
protocol Expr { | |
associatedtype A | |
func eval() -> A | |
} | |
struct Const<T>: Expr { | |
typealias A = T | |
let value: A | |
func eval() -> A { | |
return value |
// Write some awesome Swift code, or import libraries like "Foundation", | |
// "Dispatch", or "Glibc" | |
import Foundation | |
struct SampleCollection: LazyCollectionProtocol, RandomAccessCollection { | |
typealias Indices = DefaultRandomAccessIndices<SampleCollection> | |
let xs = ["a", "b", "c"] | |