-
create-react-native-app purescript-app; cd purescript-app
-
pulp init --force
-
pulp build
-
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){
// Lazy Getters | |
/* What enables Tail Recursion Modulo Cons in Javascript is a thunk in Weak Head Normal Form. | |
An expression in weak head normal form has been evaluated to the outermost data constructor, | |
but contains sub-expressions that may not have been fully evaluated. In Javascript only thunks | |
can prevent sub-expressions from being immediately evaluated. */ | |
const cons = (head, tail) => ({head, tail}); | |
create-react-native-app purescript-app; cd purescript-app
pulp init --force
pulp build
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){
In https://github.com/ekmett/lens/wiki/Derivation, we see some types for | |
composition of compositions: (.).(.), (.).(.).(.), and so on. Let's prove that | |
the type of (.).(.) is (a -> b) -> (c -> d -> a) -> c -> d -> b, as stated in | |
the site. We'll stick with prefix notation, meaning that we want the type of | |
(.)(.)(.). | |
Recall the type of composition. This should be intuitive: | |
(.) :: (b -> c) -> (a -> b) -> a -> c [1] |
// This example shows how higher-kinded types can be emulated in Swift today. | |
// It acheives correct typing at the cost of some boilerplate, manual lifting and an existential representation. | |
// The technique below was directly inspired by the paper Lightweight Higher-Kinded Polymorphism | |
// by Jeremy Yallop and Leo White found at http://ocamllabs.io/higher/lightweight-higher-kinded-polymorphism.pdf | |
/// `ConstructorTag` represents a type constructor. | |
/// `Argument` represents an argument to the type constructor. | |
struct Apply<ConstructorTag, Argument> { | |
/// An existential containing a value of `Constructor<Argument>` | |
/// Where `Constructor` is the type constructor represented by `ConstructorTag` |
module Main (main, zip, zipRecord, class ZipRowList) where | |
-- | After Tuesday's experiments, let's move onto a slightly more | |
-- | interesting example. Last time, I confess, I cheated a bit to | |
-- | avoid getting too deep into RowToList stuff. Today, I'm not | |
-- | going to cheat, and get riiiight into it. When we're thirty lines | |
-- | in, don't say you weren't warned! | |
import Prelude (($), discard, Unit) | |
import Control.Monad.Eff (Eff) |
module MapRecordWithComments where | |
-- | Type-level Tomfoolery. A million thankyous to @kcsongor and his | |
-- | unparallelled patience with me while I try to figure this stuff | |
-- | out. | |
import Prelude (($), (+), (<>), discard, show) | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log) |
Ripgrep is a fast search tool like grep
. It's mostly a drop-in replacement for ag
, also know as the Silver Searcher.
helm-ag
is a fantastic package for Emacs that allows you to display search results in a buffer.
You can also jump to locations of matches. Despite the name, helm-ag
works with ripgrep (rg
) as well
as with ag
.
{-# LANGUAGE RecordWildCards, Arrows #-} | |
import Numeric | |
import Data.Char | |
import Control.Monad | |
import Data.Monoid ((<>)) | |
import Data.List (nub, sort, reverse) | |
data RepeatBounds = RB |
{-# LANGUAGE TupleSections #-} | |
import Control.Lens | |
data Expr | |
= Var String | |
| App Expr Expr | |
| Lam String Expr | |
deriving Show |
Notes on writing a Lua Bytecode VM. Lua is a compact, minimal language designed for embedding within a larger program to provide end-user customization of program behavior. This note outlines how I would breakdown implmementing the Lua Bytecode VM in Rust. The techniques are broadly applicable to any implementation language.
I would proceed by supporting a subset of Lua that uses only numbers then move on to tables with numbers. Lua 5.3 adds integers.
Form small tests cases, compile chunks of lua code and