Skip to content

Instantly share code, notes, and snippets.

type scalar = float
type 'a one = [`one of 'a]
type 'a z = [`zero of 'a]
type 'a two = [`two of 'a]
type 'a three = [`three of 'a]
type 'a four = [`three of 'a]
let map2 f x y = Array.init (min (Array.length x) (Array.length y))
(fun n -> f x.(n) y.(n))
/*:::::::::: copySync(src, dest, [options]) ::::::::::*/
/* https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md */
let optBoolToJS = (optBool: option(bool)) =>
switch (optBool) {
| None => None
| Some(b) => Some(Js.Boolean.to_js_boolean(b));
};
type copyOpts;
module Errors: {
type t;
type baseError = {
name: string,
info: string,
message: string
};
type noHostAvailableError = {
name: string,
info: string,
module Main where
import Prelude
import Data.Generic.Rep
import Type.Proxy
import Data.Symbol (SProxy(..), reflectSymbol, class IsSymbol)
import Type.Equality
import Control.Alternative
import Control.Monad.Eff.Console (logShow)
@Thimoteus
Thimoteus / AssocList.purs
Created November 6, 2017 22:59
records as association lists
module AssocList where
import Data.List (List(..))
import Data.Record (delete, get)
import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
import Data.Tuple (Tuple(..))
import Type.Row (class RowLacks, class RowToList, Cons, Nil, RLProxy(RLProxy), kind RowList)
class RLToList
(rl :: RowList)
@i-am-tom
i-am-tom / fanfic.md
Last active April 14, 2018 22:13
The morning of Gary Burgess, 01/09/17

"For services to the PureScript Community, Gary Burgess!"

You've done it, Gary. Moore, Lineker, Coleman, and now Burgess. All the work was worth it. The halls erupted with praise. Children dressed as Space Ghost, teens with "I only get high on Halogen" t-shirts, a giant banner held aloft with the message, "Tuple @garyb me". Through the noise of the crowds and Phil's uninterpretable Northern accent, he barely managed to hear his theme tu-

BZZP. BZZP.

@i-am-tom
i-am-tom / MapRecord.purs
Last active November 25, 2024 11:14
MapRecord for PureScript, with and without comments!
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)
@yawaramin
yawaramin / sig
Last active June 12, 2022 05:03
Bourne Shell script to print out Merlin's inferred signature of an OCaml file (module)
#!/usr/bin/env sh
# Works with merlin version 2.5.4. Using protocol described at
# https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking
usage ()
{
echo Usage: either of the following will work:
echo
echo ' sig module.ml'
@justinwoo
justinwoo / extract-fieldnames.purs
Last active April 22, 2018 15:02
extract field names from rows using rowtolist
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, logShow)
import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
import Type.Proxy (Proxy(..))
import Type.Row (class ListToRow, class RowToList, Cons, Nil, kind RowList)
@mietek
mietek / Brouwer.agda
Last active June 24, 2017 11:38
“Theorem. Absurdity of absurdity of absurdity is equivalent to absurdity.”
module Brouwer where
-- From Brouwer’s Cambridge lectures on intuitionism (1946-1951):
--
-- “Theorem. Absurdity of absurdity of absurdity is equivalent to absurdity.
--
-- Proof. Firstly, since implication of the assertion y by the assertion x implies
-- implication of absurdity of x by absurdity of y, the implication of absurdity of
-- absurdity by truth (which is an established fact) implies the implication of